Skip to content

fix: Set installationId as fallback userId when user has no userId#7451

Open
asynclet wants to merge 1 commit intogetsentry:mainfrom
asynclet:fix/set-installation-id-as-fallback-userid
Open

fix: Set installationId as fallback userId when user has no userId#7451
asynclet wants to merge 1 commit intogetsentry:mainfrom
asynclet:fix/set-installation-id-as-fallback-userid

Conversation

@asynclet
Copy link

Summary

  • Fixes ID missing after setting username field #4036
  • When a SentryUser object exists with fields like email/username but no userId, the SDK now falls back to installationId as the userId — aligning with Android SDK behavior
  • Previously, the fallback only applied when no user object was set at all

Test plan

  • Updated existing test testInstallationIdSetWhenUserIsSetWithoutId to verify installationId is now set as fallback
  • Verified testInstallationIdNotSetWhenUserIsSetWithId still passes — explicit userId is not overwritten
  • Verified testInstallationIdSetWhenNoUserId still passes — no-user case unchanged

When a user object exists with email/username but no
userId, the iOS SDK now falls back to installationId,
aligning with Android SDK behavior.
@github-actions
Copy link
Contributor

Semver Impact of This PR

🟢 Patch (bug fixes)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


Bug Fixes 🐛

  • Set installationId as fallback userId when user has no userId by asynclet in #7451
  • Revert TelemetryScopeApplier gating of user attributes on sendDefaultPII by philprime in #7437

Internal Changes 🔧

  • (deps) Bump faraday from 1.10.4 to 1.10.5 by dependabot in #7446

🤖 This preview updates automatically when you update the PR.

@itaybre
Copy link
Contributor

itaybre commented Feb 13, 2026

Hey @asynclet,
Thanks for the PR, looks like we forgot to add it on v9 release.
Thanks for implementing it, but this might need to be released on v10, since it is a breaking change due to the behavior change.

What do you think @philipphofmann @philprime ? We are in v9.4.1, should we add the change now?

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 this pull request may close these issues.

ID missing after setting username field

2 participants