Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Chiusa Adatta ai principianti
#6,822 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
ios, objective-c, react-native, swift
Ambito
mobile

Direzione di ricerca

Inizia in RNSentryStart.m in corrispondenza di +startWithOptions:error: e analizza il percorso di errore di createOptionsWithDictionary:error: descritto nell’issue. Riproduci il problema con il DSN non valido in una build iOS Release, quindi verifica che initNativeSdk rifiuti l’errore di parsing e che l’app non vada più in crash; controlla il call site citato in RNSentry.mm per il comportamento risultante.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

React-Native Waiting for: Product Owner

Versions: @sentry/react-native 8.17.2, Sentry (Cocoa) 9.19.1, React Native 0.83.6 (New Architecture, prebuilt), Expo SDK 55, iOS 26.6.2 (device) and the iOS Simulator.

What happens

If Sentry.init({ dsn }) receives a string that the native SentryDsn parser rejects (in our case an unexpanded build variable, "$SOME_ENV_VAR"), the app crashes with EXC_BAD_ACCESS / KERN_INVALID_ADDRESS at 0x10 about 0.4 s after launch. The crash happens on the main thread, inside the initNativeSdk TurboModule call. Nothing reaches Sentry, because the crash happens while Sentry itself is starting.

Symbolicated stack (local Release build, lldb)

#0 +[SentrySDKInternal startWithOptions:]  options=0x0  SentrySDKInternal.m:246
       options.initialScope([[SentryScope alloc] initWithMaxBreadcrumbs:options.maxBreadcrumbs])
#1 SentrySDK.start(options: nil)                          SentrySDK.swift:121
#4 +[RNSentryStart startWithOptions:jsSdkVersion:]  options=0x0   RNSentryStart.m:44
#5 +[RNSentryStart startWithOptions:error:]                       RNSentryStart.m:24
#6 -[RNSentry initNativeSdk:resolve:rejecter:]                    RNSentry.mm:188

Cause

In RNSentryStart.m, +startWithOptions:error: calls createOptionsWithDictionary:error:. When PrivateSentrySDKOnly optionsWithDictionary:didFailWithError: fails (for example, on an invalid DSN), that returns nil and sets *errorPointer. +startWithOptions:error: doesn't check for this. It goes on to updateWithReactDefaults: and updateWithReactFinals: (both no-ops on nil), then calls [self startWithOptions:nil jsSdkVersion:…], which calls [SentrySDK startWithOptions:nil]. SentrySDKInternal then calls the nil options.initialScope block. initNativeSdk checks error only after this, and by then the app has already crashed.

Repro

  1. In a Release iOS build, call Sentry.init({ dsn: "$NOT_A_DSN", enableNative: true }).
  2. Launch the app. It crashes as shown above.
  3. With a well-formed DSN, it launches normally.

Expected

RNSentryStart startWithOptions:error: should return early when createOptionsWithDictionary fails, so initNativeSdk rejects with the parse error (SentryReactNative) and the app keeps running without native Sentry. Separately, SentrySDKInternal startWithOptions: could guard against nil options, since its Objective-C signature doesn't prevent nil.

Workaround we shipped: validate the DSN shape in JS before Sentry.init, and fail our build when the configured DSN is invalid.

Lingua principale
TypeScript
Stelle
1.8k
Fork
369
Merge medio
23h 19m
PR unite (30g)
113

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di getsentry/sentry-react-native

Tutte le issue di getsentry/sentry-react-native

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.