What React Native libraries do you use?
Expo (mobile only), React Navigation, Hermes, Expo Application Services (EAS)
Are you using sentry.io or on-premise?
sentry.io (SaS)
@sentry/react-native SDK Version
6.1.0
How does your development environment look like?
I'm using VSCode with EAS to build the native app and live update to push code.
info Fetching system and libraries information...
(node:53467) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
System:
OS: macOS 14.7
CPU: (12) arm64 Apple M2 Max
Memory: 12.67 GB / 96.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 21.1.0
path: ~/.nvm/versions/node/v21.1.0/bin/node
Yarn:
version: 1.22.22
path: /opt/homebrew/bin/yarn
npm:
version: 10.2.0
path: ~/.nvm/versions/node/v21.1.0/bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.1
- iOS 18.1
- macOS 15.1
- tvOS 18.1
- visionOS 2.1
- watchOS 11.1
Android SDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23339.11.2421.12550806
Xcode:
version: 16.1/16B40
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /usr/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.74.5
wanted: 0.74.5
expo:
"expo": "51.0.35",
"expo-application": "5.9.1",
"expo-auth-session": "5.5.2",
"expo-background-fetch": "12.0.1",
"expo-camera": "15.0.16",
"expo-constants": "16.0.2",
"expo-crypto": "13.0.2",
"expo-dev-client": "4.0.27",
"expo-device": "6.0.2",
"expo-file-system": "17.0.1",
"expo-font": "12.0.10",
"expo-image-manipulator": "12.0.5",
"expo-image-picker": "15.0.7",
"expo-insights": "0.7.0",
"expo-linking": "6.3.1",
"expo-localization": "15.0.3",
"expo-network": "6.0.1",
"expo-notifications": "0.28.18",
"expo-screen-orientation": "7.0.5",
"expo-secure-store": "13.0.2",
"expo-sqlite": "14.0.6",
"expo-system-ui": "3.0.7",
"expo-task-manager": "11.8.2",
"expo-updates": "0.25.25",
"expo-web-browser": "13.0.3",
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: Not found
newArchEnabled: Not found
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Sentry.init()
Sentry.init({
_experiments: {
replaysSessionSampleRate: 1.0,
replaysOnErrorSampleRate: 1.0,
},
attachStacktrace: true,
attachThreads: true,
attachScreenshot: areMoreTraceNeeded,
dsn: env.SENTRY_DSN,
enableNativeNagger: true,
enableNdkScopeSync: true,
environment: env.SENTRY_ENVIRONMENT,
enableAppStartTracking: true,
enableUserInteractionTracing: true,
enableNativeFramesTracking: true,
enableStallTracking: true,
autoSessionTracking: true,
attachViewHierarchy: true,
enableAutoSessionTracking: true,
integrations: [
navigationIntegration,
reactNativeTracingIntegration({
traceFetch: true,
traceXHR: true,
}),
mobileReplayIntegration({
maskAllText: false,
maskAllImages: false,
maskAllVectors: false,
}),
hermesProfilingIntegration({
platformProfilers: true,
}),
appStartIntegration({
standalone: false,
}),
],
sendDefaultPii: true,
profilesSampleRate: 1.0,
tracesSampleRate: 1.0,
sendClientReports: true,
enableNativeCrashHandling: true,
patchGlobalPromise: true,
autoInitializeNativeSdk: true,
release: env.SENTRY_RELEASE_NAME,
dist: Updates.updateId || env.SENTRY_RELEASE_NAME,
tracePropagationTargets: [env.API_URL, env.WS_URL, /^\//, /\/api\/graphql/],
debug: isDevClient, // trace sentry logs into console
beforeSend: (event, hint) => {
if (isDevClient) console.debug('[Sentry @Console]', hint.originalException || hint.syntheticException);
_set(event, 'extra.dev', dev.identifier);
return event;
},
});
Steps to Reproduce
- Just need to have the replaySessionsSampleRates to 1, call expo-updates "reloadAsync()" and once is reloaded, make the app go background on Sentry v6.
But here are the steps I did:
- Make a an app or an update without sampleRate of Sentry replays
_experiments: { replaysSessionSampleRate: 0, replaysOnErrorSampleRate: 0, },
- Make sure once you got the app updated to reboot the app once more, the issue occurs once the update is installed
- Make an update that actives the replays sampleRate
_experiments: { replaysSessionSampleRate: 1, replaysOnErrorSampleRate: 1, },
- Push the update, reload using
import { reloadAsync } from 'expo-updates';
- Once the update is running, get your app in background, the app crashes like below (actual result)
- The exception never occurs if Sentry Replays sample rate is at
0
- If kept with
1 it won't crash if I do not call ExpoUpdates.reloadAsync(), once I call it even if I do not have a pending updates, once the app reboots if I go background, it will crash again then reboot, then I'm good to set it background again, and so on...
I tried to run await Sentry.flush() before running await ExpoUpdates.reloadAsync() without success
Expected Result
To be able to uses replay session on all sessions? We were using replays on v5 but migrating v5 to v6 we get those native exception below.
Actual Result
--------- beginning of crash
11-05 06:36:06.203 16547 16547 E AndroidRuntime: FATAL EXCEPTION: main
11-05 06:36:06.203 16547 16547 E AndroidRuntime: Process: com.vooban.app.dev2, PID: 16547
11-05 06:36:06.203 16547 16547 E AndroidRuntime: java.lang.RuntimeException: Unable to stop activity {com.vooban.app.dev2/com.vooban.app.dev2.MainActivity}: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:5713)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.app.ActivityThread.performStopActivityInner(ActivityThread.java:5649)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.app.ActivityThread.handleStopActivity(ActivityThread.java:5750)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.app.servertransaction.StopActivityItem.execute(StopActivityItem.java:43)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:45)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2438)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:106)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:226)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.os.Looper.loop(Looper.java:313)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:8663)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:567)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: Caused by: java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at java.util.ArrayList.get(ArrayList.java:437)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.view.WindowManagerGlobal.setStoppedState(WindowManagerGlobal.java:790)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.app.Activity.performStop(Activity.java:8530)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: at android.app.ActivityThread.callActivityOnStop(ActivityThread.java:5705)
11-05 06:36:06.203 16547 16547 E AndroidRuntime: ... 14 more
What React Native libraries do you use?
Expo (mobile only), React Navigation, Hermes, Expo Application Services (EAS)
Are you using sentry.io or on-premise?
sentry.io (SaS)
@sentry/react-native SDK Version
6.1.0
How does your development environment look like?
I'm using VSCode with EAS to build the native app and live update to push code.
Sentry.init()
Steps to Reproduce
But here are the steps I did:
_experiments: { replaysSessionSampleRate: 0, replaysOnErrorSampleRate: 0, },_experiments: { replaysSessionSampleRate: 1, replaysOnErrorSampleRate: 1, },import { reloadAsync } from 'expo-updates';01it won't crash if I do not callExpoUpdates.reloadAsync(), once I call it even if I do not have a pending updates, once the app reboots if I go background, it will crash again then reboot, then I'm good to set it background again, and so on...I tried to run
await Sentry.flush()before runningawait ExpoUpdates.reloadAsync()without successExpected Result
To be able to uses replay session on all sessions? We were using replays on v5 but migrating v5 to v6 we get those native exception below.
Actual Result