You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import*asSentryfrom"@sentry/react-native";constIS_NATIVE_BUILD=Constants.executionEnvironment===ExecutionEnvironment.StoreClient;// Only in native builds, not in Expo Go.constnavigationIntegration=Sentry.reactNavigationIntegration({enableTimeToInitialDisplay: IS_NATIVE_BUILD,});Sentry.init({enabled: !__DEV__,dsn: "https://1b27b8c56af5b5a47387fe0ecc726353@o4508241637146624.ingest.us.sentry.io/4508241637343232",tracesSampleRate: 1.0,// uncomment the line below to enable Spotlight (https://spotlightjs.com)// enableSpotlight: __DEV__,_experiments: {replaysSessionSampleRate: 1.0,replaysOnErrorSampleRate: 1.0,},integrations: [navigationIntegration,Sentry.httpClientIntegration(),Sentry.mobileReplayIntegration(),],enableNativeFramesTracking: IS_NATIVE_BUILD,});
Steps to Reproduce
Set the enabled of Sentry.init to the value false or to !__DEV__ and also define the dsn to be a valid one, and run the app in dev mode.
Comment any line in the integrations section of Sentry.init, and then uncomment it again with RN fast refresh activated.
A native crash happens and the log is sent to Sentry in dev mode even with enabled: false
The flag enabled: false to not send any error events to Sentry, including JS or native logs.
Or update the docs mentioning this just works for JS events, not for native one.
At the moment, it appears that this is the only available solution for this problem of disabling sentry events in dev mode, though it's not very thoroughly documented.
roni-castro
changed the title
Enabled option in Sentry init does not avoid sending events to Sentry in Dev mode
Enabled option in Sentry init does not avoid sending native events to Sentry in Dev mode
Nov 7, 2024
What React Native libraries do you use?
Expo (mobile only)
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?
expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.6.1
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.3.0 - ~/.nvm/versions/node/v22.3.0/bin/node
Yarn: 1.22.22 - ~/.nvm/versions/node/v22.3.0/bin/yarn
npm: 10.8.1 - ~/.nvm/versions/node/v22.3.0/bin/npm
Watchman: 2024.10.07.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.15.2 - /Users/ronicastro/.rvm/rubies/ruby-3.1.0/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5
IDEs:
Android Studio: 2024.1 AI-241.15989.150.2411.11948838
Xcode: 15.4/15F31d - /usr/bin/xcodebuild
npmPackages:
expo: ~51.0.38 => 51.0.38
expo-router: ~3.5.23 => 3.5.23
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
react-native: 0.74.5 => 0.74.5
react-native-web: ~0.19.10 => 0.19.12
npmGlobalPackages:
eas-cli: 12.6.2
Expo Workflow: bare
Sentry.init()
Steps to Reproduce
enabled
ofSentry.init
to the valuefalse
or to!__DEV__
and also define thedsn
to be a valid one, and run the app in dev mode.integrations
section ofSentry.init
, and then uncomment it again with RN fast refresh activated.enabled: false
The app code can be downloaded here, and make sure to run the branch sentry-bug change
simulating_native_crash_debug_mode.mp4
Expected Result
The flag
enabled: false
to not send any error events to Sentry, including JS or native logs.Or update the docs mentioning this just works for JS events, not for native one.
At the moment, it appears that this is the only available solution for this problem of disabling sentry events in dev mode, though it's not very thoroughly documented.
Actual Result
The native log is unexpectedly sent to Sentry, although any JS error is not.
The text was updated successfully, but these errors were encountered: