-
-
Notifications
You must be signed in to change notification settings - Fork 60
Open
Description
Is there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Electron SDK Version
7.2.0
Electron Version
35.0.3
What platform are you using?
MacOS
Link to Sentry event
No response
Steps to Reproduce
- trigger
Sentry.setUser(user)from@sentry/electron/main - access user data in
beforeSendLogsof@sentry/electron/mainthat way:
const scope = Sentry.getGlobalScope()
const user = scope.getUser()
events sent with user data ✅
3. try to do the same on @sentry/electron/renderer
4. scope.getUser() is empty 🛑
5. setting the user from renderer - Sentry.setUser(user) from @sentry/electron/renderer
6. scope.getUser() is still empty 🛑
Expected Result
- ideally, logs will be sent with user identifier
- because it's not exists, had to use
beforeSendLog, and manually enrich the log attributes with user - I would like to set user once (in fact, for captureError seems like the error and breadcrumbs are user identified)
- If I already need to set it twice, I could set it with Sentry.setUser(user) without had to fetch scope
Actual Result
eventually wasn't ideal but it worked:
- setting the user (2nd time) from renderer that way:
const globalScope = getGlobalScope()
globalScope.setUser(user)
- accessing it the same way as before:
const scope = Sentry.getGlobalScope()
const user = scope.getUser()
Metadata
Metadata
Assignees
Labels
No labels
Projects
Status
No status