From 2a7090a4b9e657ff9d3843ba60d869520f57783c Mon Sep 17 00:00:00 2001 From: Dylan Jeffers Date: Wed, 6 May 2026 10:22:43 -0700 Subject: [PATCH] mobile: re-add Sentry with conservative sampling and ignore list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Re-introduces @sentry/react-native to the mobile app, replacing the no-op initSentry() that was left behind after the RN 0.77 upgrade. Reuses the existing SENTRY_DSN already wired through env (same project as web; events are tagged platform=mobile so they can be filtered in the Sentry UI). - tracesSampleRate dropped from 1.0 (previous config) to 0.1 to preserve quota now that the rest of the perf integration is back online. - ignoreErrors filters known-noisy transient/cancellation cases so they don't drown out actionable signal. - navigationIntegration restored so React Navigation route changes show up as transactions again. Note: native side (Podfile, sentry.gradle, sentry.properties, source map upload step) still needs to be wired up in a follow-up — the JS init alone will report errors but symbolication and the CI release step won't work until that lands. Co-Authored-By: Claude Opus 4.7 (1M context) --- packages/mobile/package.json | 1 + packages/mobile/src/app/sentry.ts | 44 ++++++++++++++++++++++++++++--- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/packages/mobile/package.json b/packages/mobile/package.json index cedc71ee925..5c8bfe53492 100644 --- a/packages/mobile/package.json +++ b/packages/mobile/package.json @@ -77,6 +77,7 @@ "@react-navigation/stack": "^7.4.2", "@redux-devtools/remote": "0.8.0", "@reduxjs/toolkit": "1.6.1", + "@sentry/react-native": "^6.20.0", "@shopify/flash-list": "^1.8.3", "@snapchat/snap-kit-react-native": "0.4.0", "@solana-mobile/mobile-wallet-adapter-protocol": "2.2.5", diff --git a/packages/mobile/src/app/sentry.ts b/packages/mobile/src/app/sentry.ts index c9665de5cf0..455bda7f153 100644 --- a/packages/mobile/src/app/sentry.ts +++ b/packages/mobile/src/app/sentry.ts @@ -1,8 +1,44 @@ -// Sentry removed from mobile - using only console logging and other error tracking +import * as Sentry from '@sentry/react-native' -export const navigationIntegration = null +import { env } from 'app/services/env' + +import packageJson from '../../package.json' + +const { version: appVersion } = packageJson + +export const navigationIntegration = Sentry.reactNavigationIntegration({ + enableTimeToInitialDisplay: true +}) export const initSentry = () => { - // No-op: Sentry disabled for mobile - // console.log('Sentry disabled for mobile app') + if (!env.SENTRY_DSN) return + + Sentry.init({ + dsn: env.SENTRY_DSN, + release: appVersion, + integrations: [ + navigationIntegration, + Sentry.reactNativeTracingIntegration() + ], + enableUserInteractionTracing: true, + tracesSampleRate: 0.1, + ignoreErrors: [ + 'Network request failed', + 'Network Error', + 'NetworkError', + 'The Internet connection appears to be offline', + 'No internet connection', + 'Connection lost', + /timeout.*exceeded/i, + 'AbortError', + 'User cancelled', + 'Login cancelled', + 'cancelled by user', + 'Non-Error promise rejection captured' + ] + }) + Sentry.setTag('platform', 'mobile') + if (process.env.VITE_CURRENT_GIT_SHA) { + Sentry.setTag('commit_sha', process.env.VITE_CURRENT_GIT_SHA) + } }