Skip to content

fix(core): Forward user geo as an object so the native scope keeps it#6309

Open
antonis wants to merge 1 commit into
mainfrom
fix/user-geo-deserialization
Open

fix(core): Forward user geo as an object so the native scope keeps it#6309
antonis wants to merge 1 commit into
mainfrom
fix/user-geo-deserialization

Conversation

@antonis

@antonis antonis commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

User geo set from JS never reached the native scope.

NATIVE.setUser builds the native userKeys by running every required key through _serializeObject, which JSON-stringifies any non-string value. geo is an object, so it crossed the bridge as a string like '{"city":"Berlin"}'. The native SDKs, however, deserialize geo from a nested map:

This PR forwards geo as a structured object so both platforms deserialize it correctly. The change is JS-only — the native deserializers already handle a nested map.

💡 Motivation and Context

Pre-existing bug surfaced while investigating #6306 (the breadcrumb-timestamp regression is fixed separately in #6308). The JS double-encoding predates #6261; #6261 only changed the Android failure mode (geo lost → whole user dropped).

Coordinates with #6289 (removes the manual iOS geo handling in favour of initWithDictionary:): both expect geo as a dictionary, so they are complementary and safe to merge in either order. This PR is the JS-layer half that makes the native geo deserialization actually receive an object.

💚 How did you test it?

  • Updated wrapper.test.ts setUser cases to assert geo is forwarded as an object (full / partial / empty / undefined). Verified they fail against the old stringifying code and pass with the fix.
  • Manually verified on Android that a nested-map geo deserializes via User.Deserializer while a JSON-string geo drops the user (confirming both the regression and the fix). iOS userFrom: already accepts a geo dictionary, which is exactly what this PR now sends.

📝 Checklist

  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing
  • No breaking changes

🔮 Next steps

@antonis antonis force-pushed the fix/user-geo-deserialization branch from 24d2176 to 3c73d82 Compare June 17, 2026 13:43
@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

None (no version bump detected)

📋 Changelog Preview

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


  • fix(core): Forward user geo as an object so the native scope keeps it by antonis in #6309
  • chore(deps): update CLI to v3.5.1 by github-actions in #6305
  • chore(deps): update JavaScript SDK to v10.58.0 by github-actions in #6296
  • chore: Fix lint issues by antonis in #6300
  • chore: Bump sample and perf test apps to React Native 0.86.0 by antonis in #6287
  • fix(deps): bump form-data from 4.0.5 to 4.0.6 by antonis in #6297
  • fix(ci): Handle @sentry-internal/* package renames in JS updater by antonis in #6295
  • Record network request/response bodies in Session Replay by alwx in #6288
  • chore(deps): bump tar from 7.5.11 to 7.5.16 by dependabot in #6293
  • fix(ci): Update renamed @sentry-internal/* packages in JS updater script by antonis in #6294
  • chore(deps): bump launch-editor from 2.11.1 to 2.14.1 by dependabot in #6291
  • chore(deps-dev): bump @babel/core from 7.26.7 to 7.29.6 by dependabot in #6292
  • fix(deps): Resolve shell-quote to >=1.8.4 (Dependabot RNSentryModule.captureEvent is ignoring environment #547) by antonis in #6286
  • fix(ci): Support version catalog in android SDK version check by antonis in #6280
  • test(e2e): Bump E2E tests to React Native 0.86.0 by antonis in #6268
  • feat(android): Add nativeStackAndroid support to NativeLinkedErrors by lucas-zimerman in #6278
  • chore(deps): bump ruby/setup-ruby from 1.310.0 to 1.313.0 by dependabot in #6282
  • chore(deps): update Maestro to v2.6.1 by github-actions in #6277
  • chore(deps): bump gradle/actions from 6.1.0 to 6.2.0 by dependabot in #6284
  • chore(deps): bump getsentry/craft from 2.26.8 to 2.26.10 by dependabot in #6283
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.26.8 to 2.26.10 by dependabot in #6281
  • chore(deps): update Sentry Android Gradle Plugin to v6.11.0 by github-actions in #6275
  • chore(deps): update Android SDK to v8.43.2 by github-actions in #6273
  • chore(deps): bump joi from 17.13.3 to 17.13.4 by dependabot in #6279

Plus 3 more


🤖 This preview updates automatically when you update the PR.

@github-actions

github-actions Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request

Generated by 🚫 dangerJS against db77d32

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 3c73d82. Configure here.

`NATIVE.setUser` ran every required user key (including `geo`) through
`_serializeObject`, which JSON-stringifies non-string values. `geo` therefore
crossed the bridge as a JSON string, but the native SDKs deserialize it from a
nested map: on Android the `User.Deserializer` threw and the whole user was
dropped, on iOS the geo was silently ignored.

Forward `geo` as a structured object instead.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@antonis antonis force-pushed the fix/user-geo-deserialization branch from 3c73d82 to db77d32 Compare June 17, 2026 14:31
@antonis antonis changed the title fix(android,core): Forward user geo as an object so the native scope keeps it fix(core): Forward user geo as an object so the native scope keeps it Jun 17, 2026
@antonis antonis marked this pull request as ready for review June 17, 2026 14:40
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.

1 participant