Look for Sentry config file/s (sentry.client.js & sentry.config.js)
Either file should contain an object like this
Sentry.init({
dsn: DSN_YOU_ACQUIRED_FROM_SENTRY
})
To disable Sentry in any env you can make use of enabled
flag in Sentry config and process.env.NODE_ENV
Node.js environment variable.
This variable is built into Node.js and is set to 'development' or 'production' depending on your app environment.
To disable in development, do the following;
Sentry.init({
dsn: DSN_YOU_ACQUIRED_FROM_SENTRY,
enabled: process.env.NODE_ENV === 'production'
})
Now Sentry will only be active in Production environment.
Read more on Sentry configuration in the official Docs.
In Next.js 15, the
instrumentationHook
experimental flag was removed as the feature was stabilized.To disable instrumentation in development environments, you can add an environment check:
While this approach works functionally, there's a caveat: Next.js still bundles the instrumentation code even though it's not being used in development.
I've submitted a feature request here to propose a solution that would allow completely disabling instrumentation in development environments.