Moves the __set_user_from_context method inside process_exception of the middleware definition.
More context on the fix:
We recommend to put Honeybadger's middleware at the top of the middleware list.
When this middleware is executed, request.user is not set yet from the other middleware. The current approach was trying to set the user session before passing on to the other middleware.
The solution is to move the method which sets the user into Honeybadger's context closer to the exception (process_exception). At that point, it is more probable to have the user session available if the proper middleware have been executed (i.e. django.contrib.auth.middleware.AuthenticationMiddleware).
Moves the
__set_user_from_context
method insideprocess_exception
of the middleware definition.More context on the fix:
request.user
is not set yet from the other middleware. The current approach was trying to set the user session before passing on to the other middleware.process_exception
). At that point, it is more probable to have the user session available if the proper middleware have been executed (i.e.django.contrib.auth.middleware.AuthenticationMiddleware
).Fixes: #155