Skip to content

fix(ios): Prevent crash when initialized with an invalid DSN - #6825

Merged
antonis merged 2 commits into
mainfrom
fix/ios-crash-invalid-dsn
Oct 2, 2026
Merged

antonis merged 2 commits into
mainfrom
fix/ios-crash-invalid-dsn

Conversation

@antonis

@antonis antonis commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix

📜 Description

This PR adds an early return on nil options at both iOS init entry points:

  • RNSentryStart.startWithOptions:error: — the JS Sentry.init → initNativeSdk bridge path. initNativeSdk now rejects with the parse error, the JS layer degrades gracefully, and the app keeps running.
  • RNSentrySDK.start:configureOptions: — the native sentry.options.json auto-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 (initNativeSdk wraps native start in try/catch and rejects on failure); this adds the matching regression test there too.

💡 Motivation and Context

Fixes #6822.

📝 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.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

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>
@github-actions

github-actions Bot commented Oct 2, 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(ios): Prevent crash when initialized with an invalid DSN by antonis in #6825
  • chore(core): resolve stale TODO comments by antonis in #6819
  • fix(profiling): Populate Hermes runtime version on JS profiles by antonis in #6817

🤖 This preview updates automatically when you update the PR.

Comment thread CHANGELOG.md Outdated
@antonis antonis added the ready-to-merge Triggers the full CI test suite label Oct 2, 2026

@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 43b8d83. Configure here.

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 413.94 ms 445.43 ms 31.49 ms
Size 50.56 MiB 56.59 MiB 6.03 MiB

@sentry

sentry Bot commented Oct 2, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.29.0 (109) Release

⚙️ sentry-react-native Build Distribution Settings

@antonis
antonis marked this pull request as ready for review October 2, 2026 10:45
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3865.60 ms 1228.83 ms -2636.77 ms
Size 5.15 MiB 6.94 MiB 1.79 MiB

Baseline results on branch: main

Startup times

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

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3852.58 ms 1232.19 ms -2620.40 ms
Size 5.15 MiB 6.94 MiB 1.79 MiB

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 431.51 ms 485.74 ms 54.23 ms
Size 50.56 MiB 56.59 MiB 6.03 MiB

Baseline results on branch: main

Startup times

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

@antonis
antonis merged commit 934a328 into main Oct 2, 2026
132 of 138 checks passed
@antonis
antonis deleted the fix/ios-crash-invalid-dsn branch October 2, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS: app crashes at launch (SIGSEGV in +[SentrySDKInternal startWithOptions:]) when the DSN is invalid — RNSentryStart starts the SDK with nil options

2 participants