diff --git a/app.config.js b/app.config.js index a778d5cf8e..c11a47cece 100644 --- a/app.config.js +++ b/app.config.js @@ -35,11 +35,6 @@ module.exports = function (config) { : undefined const UPDATES_ENABLED = !!UPDATES_CHANNEL - const USE_SENTRY = Boolean(process.env.SENTRY_AUTH_TOKEN) - const SENTRY_DIST = `${PLATFORM}.${VERSION}.${IS_TESTFLIGHT ? 'tf' : ''}${ - IS_DEV ? 'dev' : '' - }` - return { expo: { version: VERSION, @@ -197,15 +192,6 @@ module.exports = function (config) { plugins: [ 'expo-video', 'expo-localization', - USE_SENTRY && [ - '@sentry/react-native/expo', - { - organization: 'blueskyweb', - project: 'react-native', - release: VERSION, - dist: SENTRY_DIST, - }, - ], [ 'expo-build-properties', { @@ -403,22 +389,6 @@ module.exports = function (config) { projectId: '55bd077a-d905-4184-9c7f-94789ba0f302', }, }, - hooks: { - postPublish: [ - /* - * @see https://docs.expo.dev/guides/using-sentry/#app-configuration - */ - { - file: './postHooks/uploadSentrySourcemapsPostHook', - config: { - organization: 'blueskyweb', - project: 'react-native', - release: VERSION, - dist: SENTRY_DIST, - }, - }, - ], - }, }, } } diff --git a/src/App.native.tsx b/src/App.native.tsx index 63284d5d5e..2a12809912 100644 --- a/src/App.native.tsx +++ b/src/App.native.tsx @@ -1,5 +1,4 @@ import 'react-native-url-polyfill/auto' -import '#/logger/sentry/setup' import '#/lib/bitdrift' // must be near top import '#/view/icons' diff --git a/src/App.web.tsx b/src/App.web.tsx index 58754d8e46..959a69c540 100644 --- a/src/App.web.tsx +++ b/src/App.web.tsx @@ -7,6 +7,7 @@ import {RootSiblingParent} from 'react-native-root-siblings' import {SafeAreaProvider} from 'react-native-safe-area-context' import {msg} from '@lingui/macro' import {useLingui} from '@lingui/react' +import * as Sentry from '@sentry/react-native' import {QueryProvider} from '#/lib/react-query' import {Provider as StatsigProvider} from '#/lib/statsig/statsig' @@ -207,4 +208,4 @@ function App() { ) } -export default App +export default Sentry.wrap(App) diff --git a/src/logger/index.ts b/src/logger/index.ts index 70b7ee8bea..d7ffc2830a 100644 --- a/src/logger/index.ts +++ b/src/logger/index.ts @@ -6,11 +6,14 @@ import {consoleTransport} from '#/logger/transports/console' import {sentryTransport} from '#/logger/transports/sentry' import {LogContext, LogLevel, Metadata, Transport} from '#/logger/types' import {enabledLogLevels} from '#/logger/util' +import {isWeb} from '#/platform/detection' const TRANSPORTS: Transport[] = (function configureTransports() { switch (process.env.NODE_ENV) { case 'production': { - return [sentryTransport, bitdriftTransport].filter(Boolean) as Transport[] + return [isWeb && sentryTransport, bitdriftTransport].filter( + Boolean, + ) as Transport[] } case 'test': { return [] diff --git a/src/logger/sentry/setup/index.ts b/src/logger/sentry/setup/index.ts index b2695694dd..e69de29bb2 100644 --- a/src/logger/sentry/setup/index.ts +++ b/src/logger/sentry/setup/index.ts @@ -1,40 +0,0 @@ -/** - * Importing these separately from `platform/detection` and `lib/app-info` to - * avoid future conflicts and/or circular deps - */ - -import {Platform} from 'react-native' -import {nativeApplicationVersion, nativeBuildVersion} from 'expo-application' -import {init} from '@sentry/react-native' - -import {IS_TESTFLIGHT} from '#/lib/app-info' - -/** - * Examples: - * - `dev` - * - `1.57.0` - */ -const release = nativeApplicationVersion ?? 'dev' - -/** - * Examples: - * - `web.dev` - * - `ios.dev` - * - `android.dev` - * - `web.1.57.0` - * - `ios.1.57.0.3` - * - `android.1.57.0.46` - */ -const dist = `${Platform.OS}.${nativeBuildVersion}.${ - IS_TESTFLIGHT ? 'tf' : '' -}${__DEV__ ? 'dev' : ''}` - -init({ - enabled: !__DEV__, - autoSessionTracking: false, - dsn: 'https://05bc3789bf994b81bd7ce20c86ccd3ae@o4505071687041024.ingest.sentry.io/4505071690514432', - debug: false, // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production - environment: process.env.NODE_ENV, - dist, - release, -}) diff --git a/src/logger/sentry/setup/index.web.ts b/src/logger/sentry/setup/index.web.ts new file mode 100644 index 0000000000..60e1e0a558 --- /dev/null +++ b/src/logger/sentry/setup/index.web.ts @@ -0,0 +1,10 @@ +import {init} from '@sentry/react-native' + +init({ + enabled: !__DEV__, + autoSessionTracking: false, + dsn: 'https://8fb55ba4807fca137eedfc8403ee27ba@o4505071687041024.ingest.us.sentry.io/4508807082278912', + debug: false, // If `true`, Sentry will try to print out useful debugging information if something goes wrong with sending the event. Set it to `false` in production + environment: process.env.NODE_ENV, + ignoreErrors: ['t is not defined'], +})