Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NextJS package does not upload source-maps on WINDOWS #4829

Closed
3 tasks done
yoont4 opened this issue Mar 31, 2022 · 10 comments · Fixed by #6096
Closed
3 tasks done

NextJS package does not upload source-maps on WINDOWS #4829

yoont4 opened this issue Mar 31, 2022 · 10 comments · Fixed by #6096

Comments

@yoont4
Copy link

yoont4 commented Mar 31, 2022

Is there an existing issue for this?

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

  1. Setup project following NextJS docs: https://docs.sentry.io/platforms/javascript/guides/nextjs/
  2. Run next build
  3. 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.

@SheaBelsky
Copy link

I posted a similar question to this a few days ago: #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.

@AbhiPrasad
Copy link
Member

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

@yoont4
Copy link
Author

yoont4 commented Apr 1, 2022

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?

@yoont4 yoont4 changed the title NextJS package does not upload source-maps NextJS package does not upload source-maps on WINDOWS Apr 2, 2022
@yoont4
Copy link
Author

yoont4 commented Apr 2, 2022

@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: #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.

@AbhiPrasad
Copy link
Member

#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
Copy link
Contributor

@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?

@karlvd
Copy link

karlvd commented May 27, 2022

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

@h0gar
Copy link

h0gar commented Aug 30, 2022

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.

@grefrit
Copy link

grefrit commented Sep 3, 2022

Any updates on this? Core feature doesn't work on biggest desktop OS

@lobsterkatie
Copy link
Member

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.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment