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

setUserContext doesn't work #314

Closed
3 of 5 tasks
haikov opened this issue Dec 20, 2017 · 7 comments
Closed
3 of 5 tasks

setUserContext doesn't work #314

haikov opened this issue Dec 20, 2017 · 7 comments
Assignees

Comments

@haikov
Copy link

haikov commented Dec 20, 2017

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

Output of node -v && npm -v && npm ls --prod --depth=0

Config:

Sentry.config('https://[email protected]/...', {
  logLevel: SentryLog.Verbose,
}).install();

I have following issue:

setUserContext doesn't work for me. After user login event in the app I call the setUserContext function:

Sentry.setUserContext({
    id: userId,
});

Then, in debug console I see
image

But after any crash, on my Sentry dashboard, I see userId as an ip address.

@HazAT
Copy link
Member

HazAT commented Dec 20, 2017

Hey, so can you upgrade to the latest version.
I am pretty sure this bug has already been fixed, please be aware that in the latest version 0.32.0 uses the new @sentry/cli npm package, so you slightly have to adjust your build process.

But I think version 0.31.0 or 0.30.3 should also work.

@haikov
Copy link
Author

haikov commented Dec 20, 2017

@HazAT thank you for the prompt reply!

Just updated to the 0.31.0 version but it didn't help. Interesting thing that setTagsContext works and I see it in my Sentry dashboard's breadcrumbs log as
image

But I don't see setUserContext there (but I still see it in my local Chrome console)

@haikov
Copy link
Author

haikov commented Dec 20, 2017

I've found that for some reasons it's losing the userContext after application reloading. If I do the following way:

  1. Do user login and call setUserContext with user id (I see setUserContext in the logs)
  2. Reload an application (with CMD+R in development mode)
  3. Click some button to generate an exception

I don't get userId stored in the Sentry dashboard. Is it an expected behavior (I don't think so because it was working previously)?

It works if I do the following way:

  1. Use componentWillReceiveProps in App component to determine when the state gets rehydrated from redux-persist
  2. Call setUserContext once it's changed

@HazAT
Copy link
Member

HazAT commented Dec 20, 2017

@gaykov can you try to patch the RNSentry.m locally in you node_modules and see if it works:
#315

@haikov
Copy link
Author

haikov commented Dec 20, 2017

@HazAT didn't help, I still see an ip address as a user identifier. And the error in Sentry dashboard looks different from others:
image

@HazAT
Copy link
Member

HazAT commented Dec 20, 2017

OK, there must is something weird going on in your setup.
I tried it locally and it works as expected in the example project we have
https://github.com/getsentry/examples/tree/master/react-native

Can you link me to your source somehow because I am not really able to reproduce it?!

@HazAT HazAT self-assigned this Dec 20, 2017
@HazAT
Copy link
Member

HazAT commented Jan 3, 2018

I will close this for now since I wasn't able to reproduce it.
Please feel free to reopen it whenever you are able to provide a reproducible case.

@HazAT HazAT closed this as completed Jan 3, 2018
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

No branches or pull requests

2 participants