NextJS tries to upload source maps when sourcemaps.disable is set to true
Is there an existing issue for this?
- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- [x] I have reviewed the documentation https://docs.sentry.io/
- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/nextjs
SDK Version
9.34.0
Framework Version
15.3.2
Link to Sentry event
No response
Reproduction Example/SDK Setup
next.config.js file:
export default withSentryConfig(nextConfig, {
org: "...",
project: "...",
authToken:"...",
debug: true,
silent: false,
release:{
create: false,
},
sourcemaps: {
disable: true,
},
});
Steps to Reproduce
- Configure the SDK as above
- Build the app
Expected Result
The SDK does not attempt to upload source maps in any form: https://docs.sentry.io/platforms/javascript/guides/nextjs/configuration/build/#sourcemaps.disable
Actual Result
It still tries to upload source maps.
Log:
npm run build
> [email protected] build
> next build
▲ Next.js 15.3.2
- Experiments (use with caution):
· clientTraceMetadata
Creating an optimized production build ...
[@sentry/nextjs - Node.js] Info: Using environment variables configured in ".env.sentry-build-plugin".
[@sentry/nextjs - Node.js] Debug: Release injection disabled via `release.inject` option. Will not inject release.
[@sentry/nextjs - Node.js] Debug: The component name annotate plugin is currently disabled. Skipping component name annotations.
[@sentry/nextjs - Node.js] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.
[@sentry/nextjs - Node.js] Debug: Source map upload was disabled. Will not upload sourcemaps using debug ID process.
[@sentry/nextjs - Node.js] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: ...
[same for other files]
> Adding source map references
> Nothing to upload
[@sentry/nextjs - Node.js] Info: Successfully uploaded source maps to Sentry
[@sentry/nextjs - Edge] Info: Using environment variables configured in ".env.sentry-build-plugin".
[@sentry/nextjs - Edge] Debug: Release injection disabled via `release.inject` option. Will not inject release.
[@sentry/nextjs - Edge] Debug: The component name annotate plugin is currently disabled. Skipping component name annotations.
[@sentry/nextjs - Edge] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.
[@sentry/nextjs - Edge] Debug: Source map upload was disabled. Will not upload sourcemaps using debug ID process.
[@sentry/nextjs - Edge] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: ...
[same for other files]
> Found 0 files
> Adding source map references
> Nothing to upload
[@sentry/nextjs - Edge] Info: Successfully uploaded source maps to Sentry
[@sentry/nextjs - Client] Info: Using environment variables configured in ".env.sentry-build-plugin".
[@sentry/nextjs - Client] Debug: Release injection disabled via `release.inject` option. Will not inject release.
[@sentry/nextjs - Client] Debug: The component name annotate plugin is currently disabled. Skipping component name annotations.
[@sentry/nextjs - Client] Info: Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.
[@sentry/nextjs - Client] Debug: Source map upload was disabled. Will not upload sourcemaps using debug ID process.
[@sentry/nextjs - Client] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: ...
[same for other files]
> Found 0 files
> Adding source map references
> Nothing to upload
[@sentry/nextjs - Client] Info: Successfully uploaded source maps to Sentry
✓ Compiled successfully in 15.0s
Also, I noticed if we don't provide SENTRY_AUTH_TOKEN env variable, because we actually don't wont to interact with Sentry during our CI action where we runnext build, we still have warnings about the missing env variables even if they are not necessary for current configuration.
[@sentry/nextjs - Node.js] Warning: No auth token provided. Will not create release. Please set the
authTokenoption. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/ [@sentry/nextjs - Node.js] Warning: No auth token provided. Will not upload source maps. Please set theauthTokenoption. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/ error: Auth token is required for this request. Please runsentry-cli loginand try again!Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output. Please attach the full debug log to all bug reports. [@sentry/nextjs - Node.js] Info: Successfully uploaded source maps to Sentry [@sentry/nextjs - Edge] Warning: No auth token provided. Will not create release. Please set the
authTokenoption. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/ [@sentry/nextjs - Edge] Warning: No auth token provided. Will not upload source maps. Please set theauthTokenoption. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/ error: Auth token is required for this request. Please runsentry-cli loginand try again!Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output. Please attach the full debug log to all bug reports. [@sentry/nextjs - Edge] Info: Successfully uploaded source maps to Sentry [@sentry/nextjs - Client] Warning: No auth token provided. Will not create release. Please set the
authTokenoption. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/ [@sentry/nextjs - Client] Warning: No auth token provided. Will not upload source maps. Please set theauthTokenoption. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/ error: Auth token is required for this request. Please runsentry-cli loginand try again!Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output. Please attach the full debug log to all bug reports. [@sentry/nextjs - Client] Info: Successfully uploaded source maps to Sentry
Is it also possible not to check for authToken option presence if we are not going to interact with Sentry during the next build when we have the following config?
export default withSentryConfig(nextConfig, {
debug: true, // in our CI we have it disabled. I kept it enabled to stay consistent with repro config.
silent: false,
release:{
create: false,
},
sourcemaps: {
disable: true,
},
});
P.S.: we do not populate SENTRY_AUTH_TOKEN in that CI action run to not expose it when it is not necessary.
Thanks for writing in!
Ok to sum this up:
- With
sourcemaps.disable: true, no sourcemaps will be generated, uploaded or deleted - We still inject the SentryWebpackPlugin but with disabled sourcemaps settings
That being said I agree that the logs appear to noisy when sourcemaps are disabled (both for upload references and for the auth token) – I'll try to improve this!