fix(core): Align SENTRY_ENVIRONMENT/RELEASE/DIST in JS bundled options with native SDKs#6330
Merged
Conversation
…s with native SDKs The native build steps (sentry-xcode.sh, sentry.gradle.kts) apply the SENTRY_ENVIRONMENT, SENTRY_RELEASE and SENTRY_DIST build-time overrides to the native copy of sentry.options.json, but the Metro serializer that bundles __SENTRY_OPTIONS__ for JS did not. With Capture App Start Errors, native sessions and JS events could end up on different environments/releases, splitting release health (e.g. Failure Rate instead of Crash Free Session Rate). Mirror the same overrides in the Metro serializer so __SENTRY_OPTIONS__ stays in sync with the native SDKs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
antonis
commented
Jun 23, 2026
Contributor
Author
|
@sentry review |
There was a problem hiding this comment.
✅ 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 e440234. Configure here.
📲 Install BuildsAndroid
|
6 tasks
Contributor
iOS (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0bd8916+dirty | 3842.33 ms | 1230.76 ms | -2611.58 ms |
| 4e0ba9c+dirty | 3839.22 ms | 1221.06 ms | -2618.16 ms |
| 1122a96+dirty | 3823.10 ms | 1218.64 ms | -2604.46 ms |
| 04207c4+dirty | 1191.27 ms | 1189.78 ms | -1.48 ms |
| acd838e+dirty | 3849.78 ms | 1230.00 ms | -2619.78 ms |
| 23598c3+dirty | 1207.00 ms | 1209.90 ms | 2.90 ms |
| 5748023+dirty | 3840.49 ms | 1227.43 ms | -2613.05 ms |
| b0d3373+dirty | 3831.75 ms | 1227.29 ms | -2604.46 ms |
| 6177334+dirty | 3834.85 ms | 1217.58 ms | -2617.28 ms |
| 038a6d7+dirty | 3849.69 ms | 1228.40 ms | -2621.28 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0bd8916+dirty | 5.15 MiB | 6.69 MiB | 1.53 MiB |
| 4e0ba9c+dirty | 5.15 MiB | 6.67 MiB | 1.51 MiB |
| 1122a96+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| 04207c4+dirty | 3.38 MiB | 4.76 MiB | 1.38 MiB |
| acd838e+dirty | 5.15 MiB | 6.70 MiB | 1.55 MiB |
| 23598c3+dirty | 3.38 MiB | 4.80 MiB | 1.42 MiB |
| 5748023+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| b0d3373+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| 6177334+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| 038a6d7+dirty | 5.15 MiB | 6.70 MiB | 1.55 MiB |
Contributor
iOS (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0bd8916+dirty | 3816.17 ms | 1215.05 ms | -2601.12 ms |
| 4e0ba9c+dirty | 3856.39 ms | 1234.44 ms | -2621.95 ms |
| 1122a96+dirty | 3839.17 ms | 1219.23 ms | -2619.93 ms |
| 04207c4+dirty | 1228.55 ms | 1226.04 ms | -2.51 ms |
| acd838e+dirty | 3835.94 ms | 1215.87 ms | -2620.07 ms |
| 23598c3+dirty | 1223.59 ms | 1229.13 ms | 5.53 ms |
| 5748023+dirty | 3844.74 ms | 1225.49 ms | -2619.26 ms |
| b0d3373+dirty | 3842.49 ms | 1218.49 ms | -2624.00 ms |
| 6177334+dirty | 3851.52 ms | 1226.23 ms | -2625.29 ms |
| 038a6d7+dirty | 3838.96 ms | 1218.86 ms | -2620.10 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 0bd8916+dirty | 5.15 MiB | 6.69 MiB | 1.53 MiB |
| 4e0ba9c+dirty | 5.15 MiB | 6.67 MiB | 1.51 MiB |
| 1122a96+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| 04207c4+dirty | 3.38 MiB | 4.76 MiB | 1.38 MiB |
| acd838e+dirty | 5.15 MiB | 6.70 MiB | 1.55 MiB |
| 23598c3+dirty | 3.38 MiB | 4.80 MiB | 1.42 MiB |
| 5748023+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| b0d3373+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| 6177334+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| 038a6d7+dirty | 5.15 MiB | 6.70 MiB | 1.55 MiB |
Contributor
Android (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c823bb5+dirty | 468.26 ms | 516.16 ms | 47.90 ms |
| 3ce5254+dirty | 373.90 ms | 427.84 ms | 53.94 ms |
| 3d377b5+dirty | 425.38 ms | 440.67 ms | 15.30 ms |
| a50b33d+dirty | 353.21 ms | 398.48 ms | 45.27 ms |
| 580fb5c+dirty | 515.72 ms | 585.38 ms | 69.66 ms |
| c004dae+dirty | 404.60 ms | 430.67 ms | 26.07 ms |
| 038a6d7+dirty | 499.02 ms | 527.68 ms | 28.66 ms |
| 0d9949d+dirty | 414.88 ms | 428.68 ms | 13.81 ms |
| 7d6fd3a+dirty | 435.06 ms | 458.78 ms | 23.72 ms |
| 68ae91b+dirty | 515.04 ms | 578.08 ms | 63.04 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c823bb5+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 3ce5254+dirty | 43.94 MiB | 48.98 MiB | 5.04 MiB |
| 3d377b5+dirty | 43.94 MiB | 49.00 MiB | 5.06 MiB |
| a50b33d+dirty | 43.94 MiB | 48.94 MiB | 5.00 MiB |
| 580fb5c+dirty | 49.74 MiB | 54.79 MiB | 5.05 MiB |
| c004dae+dirty | 48.30 MiB | 53.49 MiB | 5.19 MiB |
| 038a6d7+dirty | 48.30 MiB | 53.60 MiB | 5.30 MiB |
| 0d9949d+dirty | 43.94 MiB | 48.99 MiB | 5.05 MiB |
| 7d6fd3a+dirty | 43.94 MiB | 49.00 MiB | 5.06 MiB |
| 68ae91b+dirty | 49.74 MiB | 54.79 MiB | 5.05 MiB |
Contributor
Android (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c823bb5+dirty | 409.87 ms | 478.57 ms | 68.70 ms |
| 5c1e987+dirty | 423.52 ms | 471.64 ms | 48.12 ms |
| 580fb5c+dirty | 436.34 ms | 471.63 ms | 35.28 ms |
| c004dae+dirty | 412.86 ms | 481.50 ms | 68.64 ms |
| 038a6d7+dirty | 524.82 ms | 531.92 ms | 7.10 ms |
| bc0d8cf+dirty | 412.37 ms | 466.26 ms | 53.89 ms |
| 44c8b3f+dirty | 414.20 ms | 457.28 ms | 43.08 ms |
| 68ae91b+dirty | 416.44 ms | 477.56 ms | 61.12 ms |
| 64630e5+dirty | 419.18 ms | 464.58 ms | 45.40 ms |
| 7887847+dirty | 416.61 ms | 462.04 ms | 45.43 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| c823bb5+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 5c1e987+dirty | 43.75 MiB | 48.08 MiB | 4.33 MiB |
| 580fb5c+dirty | 49.74 MiB | 54.79 MiB | 5.05 MiB |
| c004dae+dirty | 48.30 MiB | 53.49 MiB | 5.19 MiB |
| 038a6d7+dirty | 48.30 MiB | 53.60 MiB | 5.30 MiB |
| bc0d8cf+dirty | 48.30 MiB | 53.48 MiB | 5.18 MiB |
| 44c8b3f+dirty | 48.30 MiB | 53.46 MiB | 5.15 MiB |
| 68ae91b+dirty | 49.74 MiB | 54.79 MiB | 5.05 MiB |
| 64630e5+dirty | 49.74 MiB | 54.82 MiB | 5.07 MiB |
| 7887847+dirty | 49.74 MiB | 54.81 MiB | 5.07 MiB |
Contributor
alwx
approved these changes
Jun 24, 2026
3 tasks
antonis
added a commit
to getsentry/sentry-docs
that referenced
this pull request
Jun 25, 2026
…pp start errors (#18508) ## DESCRIBE YOUR PR Updates the **Capture App Start Errors** guide to explain how `environment`, `release`, and `dist` must stay aligned between the native SDK and JavaScript when using early native initialization. Context: corresponds to SDK fix getsentry/sentry-react-native#6330 and the report in getsentry/sentry-react-native#6329. ## IS YOUR CHANGE URGENT? - [ ] Urgent deadline (GA date, etc.): <!-- ENTER DATE HERE --> - [ ] Other deadline: <!-- ENTER DATE HERE --> - [x] None: Not urgent, can wait up to 1 week+⚠️ Should be merged after getsentry/sentry-react-native#6330 is released ## PRE-MERGE CHECKLIST *Make sure you've checked the following before merging your changes:* - [ ] Checked Vercel preview for correctness, including links - [ ] PR was reviewed and approved by any necessary SMEs (subject matter experts) - [ ] PR was reviewed and approved by a member of the [Sentry docs team](https://github.com/orgs/getsentry/teams/docs) ## EXTRA RESOURCES - [Sentry Docs contributor guide](https://docs.sentry.io/contributing/)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
The native build steps apply the
SENTRY_ENVIRONMENT,SENTRY_RELEASEandSENTRY_DISTbuild-time overrides to the native copy ofsentry.options.json(sentry-xcode.sh,sentry.gradle.kts), but the Metro serializer that produces the__SENTRY_OPTIONS__blob bundled into JS read the raw source file and applied no overrides.This change mirrors those three overrides in
createSentryOptionsModule(sentryOptionsSerializer.ts), so the JS-bundled options match the native SDKs.💡 Motivation and Context
This came up while investigating #6329
💚 How did you test it?
sentry-xcode.shtruthy semantics), unset keeps the file value, and a guard so a non-object options file doesn't throw.sdk.test.ts: anenvironmentfrom__SENTRY_OPTIONS__is used instead of the default.samples/react-native(file hasenvironment: "dev"):SENTRY_ENVIRONMENT=staging->__SENTRY_OPTIONS__.environment === "staging""dev"SENTRY_RELEASE/SENTRY_DIST-> injected;environmentunchanged📝 Checklist
sendDefaultPIIis enabled🔮 Next steps