expo / sentry-expo

MIT License
202 stars 83 forks source link

Sentry.Native.setUser not working #353

Closed MarcHbb closed 1 year ago

MarcHbb commented 1 year ago

Summary

I'm trying to retrieve user information from an issue

Sentry.Native.setUser({ id: userId, username: username });
Sentry.Native.captureException(new Error("test error"));

The issue is correctly reported, but I see no information about the user in the issue information.

EDIT

When I remove Sentry.Native.setUser({ id: userId, username: username }); I get the user id by default from sentry When I get a crash, Sentry.Native.setUser({ id: userId, username: username }); seems to work (but got null, I will check later if it's my code or not) But when I use captureException it seems to be ignored

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

iOS

SDK Version (managed workflow only)

SKD : 48.0.19 sentry-expo : ~6.1.0 @sentry/react-native: 4.13.0

Environment

System:
      OS: macOS 13.0.1
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 16.20.1 - ~/.nvm/versions/node/v16.20.1/bin/node
      Yarn: 1.22.17 - /opt/homebrew/bin/yarn
      npm: 8.19.4 - ~/.nvm/versions/node/v16.20.1/bin/npm
    Managers:
      CocoaPods: 1.12.1 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
      Android SDK:
        API Levels: 31
        Build Tools: 31.0.0
        System Images: android-29 | Google Play ARM 64 v8a, android-31 | Google APIs ARM 64 v8a
    IDEs:
      Xcode: 14.1/14B47b - /usr/bin/xcodebuild
    npmPackages:
      expo: ^48.0.19 => 48.0.19 
      react: 18.2.0 => 18.2.0 
      react-native: 0.71.8 => 0.71.8 
    npmGlobalPackages:
      eas-cli: 3.15.0
    Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

In an expo managed workflow file:

import * as Sentry from 'sentry-expo';

In a file :


Sentry.Native.setUser({ id: userId, username: username });
Sentry.Native.captureException(new Error("test error"))
MarcHbb commented 1 year ago

Seems that setUser can only support one value, closing this issue

gxxcastillo commented 7 months ago

For anyone else finding this, setUser accepts an object with multiple values: id, username, email, ip https://docs.sentry.io/platforms/javascript/enriching-events/identify-user/