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

setUser method on Android doesn't result with full data displayed if objects were passed #677

Closed
2 of 4 tasks
mefjuu opened this issue Oct 2, 2019 · 3 comments · Fixed by #749
Closed
2 of 4 tasks

Comments

@mefjuu
Copy link

mefjuu commented Oct 2, 2019

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native
  • react-native-sentry

react-native version: 0.60.4

Init Code:

Sentry.init({
  dsn: 'https://...@sentry.io/...'
});
Sentry.setExtras({
    deviceCountry: DeviceInfo.getDeviceCountry(),
    deviceLocale: DeviceInfo.getDeviceLocale(),
});

Calling setUser on Android with some extra data (other than built-in userID and username fields) has no result in Sentry logs. On iOS it's fine though.

Steps to reproduce:

Sentry.setUser({
        userID: String(id),
        username: name,
        foo: {
            bar: 'a'
        },
});
@mefjuu mefjuu changed the title setUser method on Android doesn't display full data if objects were passed setUser method on Android doesn't result with full data displayed if objects were passed Oct 2, 2019
@crazyjooe
Copy link

Having the same issue. Are there any known workarounds or estimates when this will be fixed?

@crazyjooe
Copy link

I also noticed that userID and id resolve differently on Android and iOS. So for now, to get the same behavior on both platforms, I do something like this:

const sentryUserID = `${userData.userID}:${userData.companyID}`; 

if (Platform.OS === 'android') {
    Sentry.setUser({
        userID: sentryUserID
    });
} else {
    Sentry.setUser({
        id: sentryUserID,
        userID: userData.userID,
        companyID: userData.companyID
    });
}

@mefjuu
Copy link
Author

mefjuu commented Jan 22, 2020

@crazyjooe I had to use Sentry.setExtras() method to store user's extra data.

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 a pull request may close this issue.

2 participants