diff --git a/server/channels/web/handlers.go b/server/channels/web/handlers.go index 6314ce629f..7312b4cd8a 100644 --- a/server/channels/web/handlers.go +++ b/server/channels/web/handlers.go @@ -161,8 +161,8 @@ func (h Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { mlog.String("url", r.URL.Path), mlog.String("request_id", requestID), } - // if there is a session then include the user_id - if c.AppContext.Session() != nil { + // if there is a valid session and userID then include the user_id + if c.AppContext.Session() != nil && c.AppContext.Session().UserId != "" { responseLogFields = append(responseLogFields, mlog.String("user_id", c.AppContext.Session().UserId)) }