iOS: `Sentry.Unmask` / `Sentry.Mask` ignored when replay is started manually with both sample rates at 0
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
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- ios, objective-c, react-native, typescript
- Área
- backend-api-design, mobile
Línea de trabajo
Empieza en RNSentryStart.m e inspecciona la condición de protección de la inicialización de replay descrita en el issue; después lee RNSentryReplay postInit para confirmar qué registra. La solución indicada consiste en llamar a postInit siempre que replay sea compatible, incluso cuando ambas tasas de muestreo sean cero. Se considera terminado cuando el replay manual conserva el comportamiento de Sentry.Unmask y Sentry.Mask en iOS con esos ajustes.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
What React Native libraries do you use?
Expo (SDK 57, CNG / expo prebuild), Expo Router, React Native 0.86 (New Architecture), Hermes.
Are you using sentry.io or on-premise?
sentry.io (SaaS, EU region)
@sentry/react-native SDK Version
8.33.0 (sentry-cocoa 9.32.0). The same condition is still present in 8.34.0 and on main.
How does your development environment look like?
@sentry/react-native 8.33.0
sentry-cocoa 9.32.0 (prebuilt xcframework)
react-native 0.86.3, New Architecture enabled
expo 57
iOS TestFlight build, iPhone
Sentry.init()
Sentry.init({
dsn: '...',
sendDefaultPii: false,
// Replay is only recorded on one screen, started and stopped manually
// (Sentry.getReplay().start() / stop(), available since 8.27).
replaysSessionSampleRate: 0,
replaysOnErrorSampleRate: 0,
integrations: [
Sentry.mobileReplayIntegration({
maskAllText: true,
maskAllImages: true,
maskAllVectors: true,
}),
],
});
// Later, on the screen we want to record (with user consent):
Sentry.getReplay()?.start();
Steps to Reproduce
- Initialize the SDK with
replaysSessionSampleRate: 0andreplaysOnErrorSampleRate: 0, andmobileReplayIntegration({ maskAllText: true }). - Wrap a static label in
<Sentry.Unmask><Text>Continue</Text></Sentry.Unmask>. - Start the replay manually with
Sentry.getReplay().start()and navigate the screen. - Open the replay in Sentry.
Expected Result
The Text wrapped in Sentry.Unmask is visible in the replay, as it is on Android and as it is on iOS when a sample rate is positive. Sentry.Mask masks its subtree.
Actual Result
On iOS, the whole replay is masked: Sentry.Unmask has no effect (and Sentry.Mask is not registered either). Android is fine.
Cause
RNSentryStart.m only registers the replay container classes when a sample rate is positive:
[SentrySDK startWithOptions:options];
#if SENTRY_TARGET_REPLAY_SUPPORTED
if (options.sessionReplay.sessionSampleRate > 0
|| options.sessionReplay.onErrorSampleRate > 0) {
[RNSentryReplay postInit];
}
#endif
+[RNSentryReplay postInit] is what calls setReplayRedactContainerClass: (RNSentryReplayMask), setReplayIgnoreContainerClass: (RNSentryReplayUnmask) and configures the RN breadcrumb converter. Since 8.27, a replay can be started manually with both rates at 0, and sentry-cocoa 9.32.0 always installs SentrySessionReplayIntegration on iOS, whatever the rates. The replay therefore records, but without the container classes: Unmask is ignored, Mask is not applied as a container, and replay breadcrumbs go through the default converter instead of RNSentryReplayBreadcrumbConverter.
Raising a rate is not a workaround for us: it would record (or buffer) replays outside the screen the user consented to, without the on-screen recording indicator we show (App Store Review Guideline 2.5.14).
Suggested fix
Call postInit whenever the replay is supported, regardless of the sample rates:
#if SENTRY_TARGET_REPLAY_SUPPORTED
[RNSentryReplay postInit];
#endif
postInit does not start any recording: it only registers the two container classes and the breadcrumb converter on the installed integration (SentryInternalReplayApi calls are no-ops if the integration is missing). We apply exactly this change at prebuild time as a local workaround.
- Lenguaje dominante
- TypeScript
- Estrellas
- 1.8k
- Forks
- 373
- Merge medio
- 1 d 7 h
- PR fusionados (30 d)
- 105
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
-
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
-
Good First Issue React-Native Task
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
getsentry/sentry-react-native#5771 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de getsentry/sentry-react-native
Issues similares
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
pending close triaging
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
anomalyco/opencode#62582 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
feature request
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
callstack/react-native-paper#5189 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
live-codes/livecodes#1079 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Add: ESP 2 ROAbiertoapproved check:passed streams:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 1 día