NextJS package does not upload source-maps on WINDOWS
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 package are you using?
@sentry/nextjs
SDK Version
6.19.3
Framework Version
6.19.3
Link to Sentry event
No response
Steps to Reproduce
- Setup project following NextJS docs: https://docs.sentry.io/platforms/javascript/guides/nextjs/
- Run
next build - Run
next start
Expected Result
Source-maps uploaded
Actual Result
No source-maps uploaded.
I'm not sure what I'm supposed to see either to confirm they get uploaded or not.
I've manually configured a release version in the sentry.client/server.config.js files to see if that was the issue, and that didn't change anything. All it did was make an empty release bucket with no artifacts.
I've tried setting the SENTRY_RELEASE environment variable using cross-env and a .env file (in separate attempts) and they both did nothing.
I've tried manually setting the release field in the sentryWebpackPluginOptions as well to see if the sentry-webpack-plugin needed it, and that did nothing.
I've watched the netlify and vercel videos on sentry's youtube channel, and they both just refer to some netlify or vercel plugin to handle it. But the docs clearly state that @sentry/nextjs will automatically handle the sourcemap uploads! I am completely at a loss. I see 0 output, no errors, no warnings, nothing.
I posted a similar question to this a few days ago: https://github.com/getsentry/sentry-javascript/discussions/4812
There's a lack of clarity on how Sentry sourcemaps are supposed to be handled for a CI/CD environment on Next.js apps. Not every Next.js app runs on Vercel, and documentation/clarity for how other CI/CD platforms are intended to work would be great.
Hey, thanks for writing in. Great feedback - we recognize that our documentation can be improved for non-vercel environments for NextJS, appreciate the further context though. I'll be backlogging this as a documentation task for us to work on.
You'll have to use config files or environmental variables (like Sentry auth token, org name, project name) to configure Sentry CLI to upload the assets: https://docs.sentry.io/platforms/javascript/guides/nextjs/manual-setup/#configure-sentry-cli
You can get more details on the Sentry Auth Token and how it's generated here: https://docs.sentry.io/product/cli/configuration/#to-authenticate-manually
Hi @AbhiPrasad, thanks for taking the time to review my post :)
I want to note that I did already try configuring it with the sentry.properties and .sentryclirc file mentioned in your link. I've generated an auth token with the default permissions + project_write just in case, and that is what I set in the .sentryclirc file.
Here is what I have in my sentry.properties file:
defaults.url=https://sentry.io/
defaults.org=<redacted>
defaults.project=<redacted>
cli.executable=../node_modules/@sentry/cli/bin/sentry-cli
and this is how my .sentryclirc file looks:
[auth]
token=<redacted>
To my eyes, it looks like it matches the requirements of the CLI configuration steps outlined in the docs:
SENTRY_URL, SENTRY_ORG, SENTRY_PROJECT, SENTRY_AUTH_TOKEN
Is there something I am missing?
@AbhiPrasad I've tested the exact same workflow now on an Ubuntu VM, and confirmed that it does try to upload there. I shared my branch with a coworker who runs on Mac and also verified it tries to run there, so it looks like specifically it doesn't work on windows.
Looks like there is a potentially relevant bug here: https://github.com/getsentry/sentry-javascript/issues/4720
But I have WSL installed, so I don't think that is the issue here. Any thoughts? I feel this is now an actual bug and not just a documentation issue, unless Windows support for the @sentry/nextjs package isn't intended.
#4720 is related to SDK development - I don't think it applies here. I think you're right it could be more than a docs issue - I'll expand the scope.
The issue might be with https://github.com/getsentry/sentry-webpack-plugin (which is what the NextJS SDK uses under the hood) or https://github.com/getsentry/sentry-cli/ (which does the actual uploading of source maps).
@kamilogorek the webpack plugin/sentry-cli should work fine in Windows or WSL right?
@kamilogorek the webpack plugin/sentry-cli should work fine in Windows or WSL right?
Yes, it should work just fine in most environments, including windows.
Can you set SENTRY_LOG_LEVEL=debug env variable and run the build again? It should produce more verbose output. However, I don't see you providing any logs so far, so I'm not sure if there is a problem with printing anything to the console or you just don't see any logs?
I experienced the same problem and could narrow it down to v 6.17.0 Running ~6.16.0 works and will output a log during build like `
Adding source map referencess Rewriting completed in 0.127s Adding source map references Bundling files for upload... ~/_next/server/chunks/2261.js.map Bundling completed in 0.081s Optimizing completed in 0.001s Uploading release files... ██░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 16.35KB/543.17KB (1s) Bundling files for upload... ~/_next/server/pages/xxx.js Bundling completed in 0.068s Optimizing completed in 0.002s Uploading completed in 0.8s Uploading completed in 0.798s Uploaded release files to Sentry Processing completed in 0.163s File upload complete (processing pending on server) Organization: xxx Project: xxx Release: 8PS1gAp9UfTwdwOpJYJ-h Dist: None`
With ~6.17.0 and above there is no output at all with SENTRY_LOG_LEVEL=debug
A temporary solution is to downgrade to ~6.16.0
Same problem here with @sentry/nextjs 7.11.1. It does not upload on Windows but it does on Ubuntu.
It checks if the file exists "node_modules/@sentry/cli/sentry-cli" exists: https://github.com/getsentry/sentry-javascript/blob/master/packages/nextjs/src/config/webpack.ts#L447
But it does not, at this location. However sentry-cli is at node_modules/@sentry/cli/bin/sentry-cli and node_modules/.bin/sentry-cli
Just replacing "@sentry/cli/sentry-cli" with "@sentry/cli/bin/sentry-cli" in webpack.ts makes it work on Windows.
Any updates on this? Core feature doesn't work on biggest desktop OS
It checks if the file exists "node_modules/@sentry/cli/sentry-cli" exists: master/packages/nextjs/src/config/webpack.ts#L447
But it does not, at this location. However sentry-cli is at node_modules/@sentry/cli/bin/sentry-cli and node_modules/.bin/sentry-cli
@h0gar - node_modules/@sentry/cli/bin/sentry-cli is the JS wrapper, whereas node_modules/cli/sentry-cli is the actual binary, which is what's being looked for in that function.
