iOS: app crashes at launch (SIGSEGV in `+[SentrySDKInternal startWithOptions:]`) when the DSN is invalid — `RNSentryStart` starts the SDK with nil options
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 84/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- ios, objective-c, react-native, swift
- Área
- mobile
Línea de trabajo
Comienza en RNSentryStart.m en +startWithOptions:error: e inspecciona la ruta de fallo de createOptionsWithDictionary:error: descrita en el issue. Reproduce el problema con el DSN no válido en una compilación de iOS Release y, después, verifica que initNativeSdk rechaza el error de parseo y que la aplicación ya no se bloquea; comprueba el punto de llamada citado en RNSentry.mm para observar el comportamiento resultante.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
- In a Release iOS build, call
Sentry.init({ dsn: "$NOT_A_DSN", enableNative: true }). - Launch the app. It crashes as shown above.
- 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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.8k
- Forks
- 369
- Merge medio
- 19 h 53 min
- PR fusionados (30 d)
- 107
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getsentry/sentry-react-native
-
sendDefaultPii is reported as deprecated on ReactNativeOptions although dataCollection is hiddenPosiblemente ocupada @alwx la tomó hace 5 días. AbiertoBug React-Native
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
getsentry/sentry-react-native#6830 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
React-Native Replays Task
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
getsentry/sentry-react-native#6680 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Improvement React-Native
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
getsentry/sentry-react-native#6143 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
React-Native Task User Feedbacks
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
getsentry/sentry-react-native#5932 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
React-Native Replays Task
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
getsentry/sentry-react-native#5882 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de getsentry/sentry-react-native
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
cameri/nostream#811 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug p3 triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
bug javascript P2-medium python release:v3.1
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
adrirubio/claude-deck#546 ·
Los mantenedores suelen responder en 1 día
-
area: desktop area: website priority: P2 type: feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
appandflow/stim#3411 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
rjsf-team/react-jsonschema-form#5485 ·
Los mantenedores suelen responder en 2 días