getsentry / getsentry/sentry

Unknown user despite userId, userName set.

Open
#70,196 2 comments 0 reactions 0 assignees View on GitHub
Bug Cocoa iOS Mobile
Dominant language
Python
Stars
44.8k
Forks
4.9k
Avg merge
22h 21m
Merged PRs (30d)
586

Description

### Environment

SaaS (https://sentry.io/)

### Steps to Reproduce

Unclear.
Event which exhibits the problem: [us.sentry.io.json](https://github.com/getsentry/sentry/files/15194832/us.sentry.io.json)
Event which shows the user correctly: [us.sentry.io.json](https://github.com/getsentry/sentry/files/15194865/us.sentry.io.json)
You will notice, both events contain an e-mail address and user name in the user key.
We do notice that the problem exhibits on iOS whereas the working issue was reported under Linux.
Both events are for the same project.

open func startCrashLogger() {
SentrySDK.start(configureOptions: self.sentry(options:))
}

open func sentry(options: Sentry.Options) {
// TODO: https://github.com/getsentry/team-mobile/issues/24
// options.enabled = false
options.sendDefaultPii = true
options.environment = AppInfo.shared.configuration.lowercased()
options.enablePreWarmedAppStartTracing = true
options.enableMetricKit = true
options.swiftAsyncStacktraces = true
options.initialScope = self.sentry(scope:)
options.beforeSend = self.sentry(event:)
options.attachScreenshot = true
options.attachViewHierarchy = true
options.dsn = "https://68d13d7dab6f450090a1045d141b108f@o378389.ingest.sentry.io/5225762"
options.tracesSampleRate = 0.1
options.profilesSampleRate = 0.1
}

open func sentry(scope: Sentry.Scope) -> Sentry.Scope {
scope.setTag(value: AppInfo.shared.build, key: "app.build")
scope.setTag(value: AppInfo.shared.version, key: "app.version")
scope.setTag(value: AppInfo.shared.configuration, key: "app.configuration")
scope.setTag(value: AppInfo.shared.reference, key: "app.reference")
scope.setTag(value: AppInfo.shared.revision, key: "app.revision")
return scope
}

open func sentry(event: Sentry.Event) -> Sentry.Event? {
event
}

### Expected Result

I expect both events to show the user described under the Tags header in the Sentry report.

### Actual Result

(Note however that both events correctly report the user in the details area)

Event which exhibits the problem:
image
image

Event which shows the user correctly:
image
image

### Product Area

Issues

### Link

https://hubstaff.sentry.io/issues/5278254369/events/863b8b8487bb46e08927cb2dfbc97d5b/

### DSN

https://68d13d7dab6f450090a1045d141b108f@o378389.ingest.sentry.io/5225762

### Version

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.