What is the recommended way to avoid sending errors generated while developing to Sentry in JS and the native side?
Option 1:
Sentry.init({
enabled: !__DEV__
dsn: "SOME_VALID_URL"
})
Result: This just works for js errors, but keep sending native errors to Sentry
Option 2:
if(!__DEV__) {
Sentry.init({
dsn: "SOME_VALID_URL"
})
}
Result: This will generate a warning when using Sentry.wrap
in the root component
App Start Span could not be finished.
Sentry.wrap
was called beforeSentry.init
.
if(!__DEV__) {
Sentry.init({
dsn: "SOME_VALID_URL"
})
}
function RootLayout() {
...
}
export default Sentry.wrap(RootLayout);
According to the Sentry options docs, it suggests setting dns to undefined
.
- The Dsn used to connect to Sentry and identify the project. If omitted, the SDK will not send any data to Sentry.
Sentry.init({
dsn: __DEV__
? undefined
: "YOUR_SENTRY_DSN_URL"
})
Be careful with enabled: !__DEV__
. It currently keeps sending native errors generated in dev mode
How to disable sentry in development ?
How to disable sentry while debugging?
Enabled option in Sentry init does not avoid sending native events to Sentry in Dev mode