fix(ios): Prevent crash when initialized with an invalid DSN - #6825
Merged
Merged
Conversation
When Sentry is initialized with a DSN (or any option) the native parser rejects, option creation returned nil and the SDK was started with nil options, crashing in +[SentrySDKInternal startWithOptions:]. Both iOS init entry points now return early on nil options so init rejects/degrades instead of crashing: - RNSentryStart.startWithOptions:error: (JS Sentry.init bridge path) - RNSentrySDK.start:configureOptions: (native sentry.options.json auto-init) Adds regression tests for both iOS paths and the equivalent Android path (which already guards via try/catch at the bridge). 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
Oct 2, 2026
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 43b8d83. Configure here.
Contributor
Android (legacy) Performance metrics 🚀
|
📲 Install BuildsAndroid
|
antonis
marked this pull request as ready for review
October 2, 2026 10:45
Contributor
iOS (legacy) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 64630e5+dirty | 3842.70 ms | 1218.11 ms | -2624.60 ms |
| b0d3373+dirty | 3831.75 ms | 1227.29 ms | -2604.46 ms |
| b04af96+dirty | 3818.92 ms | 1219.76 ms | -2599.16 ms |
| 3d31fcf+dirty | 3838.09 ms | 1223.46 ms | -2614.63 ms |
| a0a3177+dirty | 3844.73 ms | 1225.23 ms | -2619.51 ms |
| af33f3b+dirty | 3849.98 ms | 1236.45 ms | -2613.53 ms |
| 09a902f+dirty | 3835.67 ms | 1217.11 ms | -2618.57 ms |
| 5a316ea+dirty | 3820.11 ms | 1211.28 ms | -2608.83 ms |
| acd838e+dirty | 3849.78 ms | 1230.00 ms | -2619.78 ms |
| c2e182c+dirty | 3848.40 ms | 1211.79 ms | -2636.61 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 64630e5+dirty | 4.98 MiB | 6.46 MiB | 1.49 MiB |
| b0d3373+dirty | 5.15 MiB | 6.68 MiB | 1.53 MiB |
| b04af96+dirty | 4.98 MiB | 6.54 MiB | 1.56 MiB |
| 3d31fcf+dirty | 4.98 MiB | 6.56 MiB | 1.58 MiB |
| a0a3177+dirty | 4.98 MiB | 6.55 MiB | 1.58 MiB |
| af33f3b+dirty | 4.98 MiB | 6.51 MiB | 1.54 MiB |
| 09a902f+dirty | 4.98 MiB | 6.46 MiB | 1.49 MiB |
| 5a316ea+dirty | 4.98 MiB | 6.51 MiB | 1.53 MiB |
| acd838e+dirty | 5.15 MiB | 6.70 MiB | 1.55 MiB |
| c2e182c+dirty | 4.98 MiB | 6.50 MiB | 1.52 MiB |
Contributor
iOS (new) Performance metrics 🚀
|
Contributor
Android (new) Performance metrics 🚀
|
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 7436d0f+dirty | 429.58 ms | 452.52 ms | 22.94 ms |
| b0d3373+dirty | 412.17 ms | 452.84 ms | 40.67 ms |
| 7ac3378+dirty | 410.67 ms | 442.60 ms | 31.92 ms |
| 53a3f8e+dirty | 422.00 ms | 436.96 ms | 14.96 ms |
| e763471+dirty | 538.31 ms | 574.44 ms | 36.13 ms |
| c004dae+dirty | 404.60 ms | 430.67 ms | 26.07 ms |
| bfba737+dirty | 425.19 ms | 465.98 ms | 40.79 ms |
| f3215d3+dirty | 396.53 ms | 436.66 ms | 40.13 ms |
| 23598c3+dirty | 371.92 ms | 420.65 ms | 48.74 ms |
| ad66da3+dirty | 411.49 ms | 449.38 ms | 37.89 ms |
App size
| Revision | Plain | With Sentry | Diff |
|---|---|---|---|
| 7436d0f+dirty | 48.30 MiB | 53.60 MiB | 5.30 MiB |
| b0d3373+dirty | 48.30 MiB | 53.58 MiB | 5.28 MiB |
| 7ac3378+dirty | 43.94 MiB | 48.99 MiB | 5.05 MiB |
| 53a3f8e+dirty | 50.56 MiB | 56.46 MiB | 5.90 MiB |
| e763471+dirty | 49.74 MiB | 54.85 MiB | 5.11 MiB |
| c004dae+dirty | 48.30 MiB | 53.49 MiB | 5.19 MiB |
| bfba737+dirty | 49.74 MiB | 55.09 MiB | 5.34 MiB |
| f3215d3+dirty | 48.30 MiB | 53.49 MiB | 5.19 MiB |
| 23598c3+dirty | 43.94 MiB | 49.02 MiB | 5.08 MiB |
| ad66da3+dirty | 48.30 MiB | 53.49 MiB | 5.19 MiB |
alwx
approved these changes
Oct 2, 2026
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
This PR adds an early return on
niloptions at both iOS init entry points:RNSentryStart.startWithOptions:error:— the JSSentry.init→initNativeSdkbridge path.initNativeSdknow rejects with the parse error, the JS layer degrades gracefully, and the app keeps running.RNSentrySDK.start:configureOptions:— the nativesentry.options.jsonauto-init path, which had the same latent crash when both the options file and the empty-options fallback fail to produce options.Android already guards this at the bridge (
initNativeSdkwraps native start intry/catchand rejects on failure); this adds the matching regression test there too.💡 Motivation and Context
Fixes #6822.
📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps