Open iffy opened 8 years ago
Any update on this?
Is my suggested fix not a good one? Or are you waiting for me to file a PR?
I am not sure if that is actually the correct fix here. For the moment I think it makes sense to put this into the docs (that you need to initialize this early together with the rest of the app).
If you initialize
raven.contrib.flask.Sentry
after a Flaskbefore_request
has been defined (in whichsentry.user_context
is used), the user context is destroyed when sending errors.For instance, in the code below the user context sent to Sentry only has an ip address. But if you uncomment "Option A" and comment out the "Option B", the user context contains
email=bob@bob.com
(and the other items).I think it's because
get_user_info
in this spot returnsNone
and mergingNone
overwrites existing values:So maybe the fix is to have
Context.merge
treatNone
s as{}
. Or maybeget_user_info
should return{}
instead ofNone
.Or maybe this: