Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(django): capture user name and id #176

Merged
merged 1 commit into from
Aug 4, 2024
Merged

Conversation

subzero10
Copy link
Member

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).

Fixes: #155

@subzero10 subzero10 requested a review from joshuap August 1, 2024 09:46
@subzero10 subzero10 self-assigned this Aug 1, 2024
@subzero10 subzero10 merged commit 90a122b into master Aug 4, 2024
19 checks passed
@dotysan
Copy link
Contributor

dotysan commented Aug 5, 2024

Looks good!
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants