Repository navigation
fix(ios): Don't crash on a null DSN in sentry.options.json - #6958
Merged
Merged
Conversation
An options file with `"dsn": null` passed NSNull into getURLFromDSN:, which threw an NSInvalidArgumentException at launch. Android already guards this case. Also adds tests for the RNSentrySDK start paths: null DSN in the options file, an invalid DSN set in configureOptions, and starting from JS after a skipped native start. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <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. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 66207b7. Configure here.
📲 Install BuildsAndroid
|
antonis
marked this pull request as ready for review
October 28, 2026 11:51
3 tasks done
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
Follow-up to #6956.
If an app starts the SDK natively and its
sentry.options.jsoncontains"dsn": null, iOS crashes at launch with-[NSNull length]: unrecognized selector(an uncaughtNSInvalidArgumentException).createOptionsWithDictionarypasses the rawdsnvalue intogetURLFromDSN:, and[NSURL URLWithString:]throws onNSNull.getURLFromDSN:now returnsnilfor anything that isn't a string. With #6956, the start is then skipped because there's no valid DSN, and JS can still initialize the native SDK later.Also adds tests for the
RNSentrySDKstart paths that #6956 didn't cover:"dsn": nullin the options file: doesn't crash and doesn't start.configureOptionssets an invalid DSN: doesn't start.💡 Motivation and Context
Found while adding tests for #6956: the null-DSN test crashed the test runner. The crash was already on
mainbefore #6956 and isn't caused by it. Android already guards this case (RNSentryStart.java). The JS init path is unaffected because JS doesn't start the native SDK without a DSN.💚 How did you test it?
Locally, iPhone 16 Pro simulator, Release configuration (same as CI):
testDoesNotStartWithNullDsnInOptionsFilecrashed with-[NSNull length]before the fix and passes after it.RNSentryStartFromFileTests,RNSentryStartTests,RNSentrySDKStartInvalidOptionsTests: 27 tests, all passed.RNSentryCocoaTestersuite: 204 tests, 0 failures.yarn lint:clangandyarn lint:swiftpass.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
🤖 Generated with Claude Code