From ed101deb81a2e85a157456141ee74b22f3f74c2e Mon Sep 17 00:00:00 2001 From: Greg Price Date: Tue, 3 Oct 2023 14:58:43 -0700 Subject: [PATCH] sentry: Disable Sentry native code on Android Using the new option added in @sentry/react-native 5.10.0: https://github.com/getsentry/sentry-react-native/releases/tag/5.10.0 Greg found in testing that this, plus re-enabling Sentry on Android (coming up) seems adequate for #5766. --- src/sentry.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/sentry.js b/src/sentry.js index d6a03796d8a..7150ef467a9 100644 --- a/src/sentry.js +++ b/src/sentry.js @@ -4,6 +4,7 @@ import { nativeApplicationVersion } from 'expo-application'; // $FlowFixMe[untyped-import] import md5 from 'blueimp-md5'; +import { Platform } from 'react-native'; import type { Identity } from './types'; import isAppOwnDomain from './isAppOwnDomain'; import store from './boot/store'; @@ -153,10 +154,22 @@ export const initializeSentry = () => { Sentry.init({ dsn: key, + ignoreErrors: [ // RN's fetch implementation can raise these; we sometimes mimic it 'Network request failed', ], + + ...(Platform.OS === 'android' + ? { + // Disable Sentry's native code (libsentry.so), because it has + // memory-corruption bugs that cause the app to crash. + // https://github.com/zulip/zulip-mobile/issues/5766 + // https://github.com/getsentry/sentry-java/issues/2955#issuecomment-1739030872 + enableNdk: false, + } + : Object.freeze({})), + beforeBreadcrumb(breadcrumb: Breadcrumb, hint?: BreadcrumbHint): Breadcrumb | null { try { return scrubBreadcrumb(breadcrumb, hint);