Mobile Crash Reporting
When the mobile app crashes (JS error OR native Java/ObjC), we want to know — without depending on user reports.
Tools wired
Sentry React Native (@sentry/react-native v8.8.0)
- Init in
mobile/app/_layout.tsxreadsEXPO_PUBLIC_SENTRY_DSN - No-op safe: empty DSN = silently disabled, app behaves identically
- Captures: unhandled JS errors, unhandled promise rejections, native crashes (Java/ObjC), explicit
Sentry.captureException()calls - Strips PII from request body, cookies before send
- 10% performance trace sampling (
tracesSampleRate: 0.1)
React ErrorBoundary
- Class component in
_layout.tsxcatches React render errors - Forwards to Sentry via
Sentry.captureException()with thecomponentStackas context - Shows a "Something went wrong" screen with stack trace + "Try Again" button (only in dev / first-launch — production users get a cleaner screen)
Setup (when you're ready to enable)
- Create Sentry project at sentry.io, platform = React Native, project name
ka26-mobile - Copy DSN from setup screen
- Add to
mobile/app.jsonunderextra:{"expo": {"extra": {"EXPO_PUBLIC_SENTRY_DSN": "https://xxx@oXXX.ingest.sentry.io/YYY"}}} - Rebuild APK — Sentry boots on next launch
What you'll see in Sentry
- Issues feed — every JS error grouped by stack trace
- Performance — slow transactions (rare for mobile)
- Release health — crash-free user % per release (target 99.5%+)
- Breadcrumbs — last 100 actions before the error (taps, navigation, fetches)
Alerting
Default Sentry alert: any new error type (never seen before) triggers an email. Configure on the project's Alerts page.
What NOT to forward to Sentry
- Routine 4xx errors that we threw on purpose (
Authentication required,Rate limit exceeded) — these are filtered out viaignoreErrorsconfig - Network blips (
Network request failed,AbortError) — filtered, too noisy
Local crash debug (when no Sentry)
- iOS: Xcode → Devices and Simulators → device logs
- Android:
adb logcat -s ReactNative:V ReactNativeJS:V - Expo Dev Menu (shake the device): "Show Performance Monitor" + "Debug Remote JS"
Related
- Production Monitoring — full 3-layer stack including web Sentry
- Build & Release