getsentry / sentry-javascript-bundler-plugins

JavaScript Bundler Plugins for Sentry
https://sentry.io
BSD 3-Clause "New" or "Revised" License
141 stars 36 forks source link

Sentry tries to upload sourcemaps before build completes - `[sentry-webpack-plugin] Warning: Didn't find any matching sources for debug ID upload` #620

Open mdwyer-od opened 1 month ago

mdwyer-od commented 1 month ago

Environment

@sentry/webpack-plugin: 2.22.5 @nuxtjs/sentry: 8.0.8 @sentry/core: 7.119.2 nuxt: 2.17.3

Steps to Reproduce

sentry: {
    dsn: <dsn>,
    disabled: false,
    config: {
      environment: process.env.ENV,
      release: process.env.npm_package_version,
      autoSessionTracking: false,
      debug: false,
      attachStacktrace: true
    },
    publishRelease: isDevelopmentMode ? false : {
      authToken: process.env.SENTRY_AUTH_TOKEN,
      url: <url>,
      org: <org>,
      project: <project>,
      debug: true,
      sourcemaps: {
        assets: [`./dist/**/*`],
        ignore: ['./node_modules/**']
      }
    },

Expected Result

Sourcemaps are uploaded to Sentry.

Actual Result

Sentry appears to be trying to upload sourcemaps before the nuxt generate command completes. We use Github Actions to build the app. Here's the GA output:

> nuxt generate && mv ./dist/assets/* dist/ && rmdir ./dist/assets
[success] [nuxt:sentry] Sentry reporting is enabled (client side: enabled, server side: enabled)
[info] Production build
[info] Bundling only for client side
[info] Target: static
[success] Builder initialized
[success] Nuxt files generated
Error:  [BABEL] Note: The code generator has deoptimised the styling of /runner/_work/<thing>/<thing>/services/<api>/<sdk>/api.ts as it exceeds the max of 500KB.
[log] [sentry-webpack-plugin] Warning: Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.
[success] [nuxt:sentry] Sentry reporting is enabled (client side: enabled, server side: enabled)
[info] Generating output directory: dist/
[info] Generating pages
[success] Generated route "/"
[success] Client-side fallback created: `200.html`
> <project>@<version> generate-sitemap
> node ./pipeline/sitemap-gen.js
fetching current sitemap.xml
fetching published product ids...
generating sitemap.xml
done

As you can see, the webpack plugin does not does not find the sources, which I believe is because the generate command hasn't finished building yet. I added a few echo statements in the command on the first line to be sure (removed here). Have I configured something incorrectly? This is part of an upgrade from the 1.x version of the plugin, and sourcemap upload seemed to work before.

Additionally, the command works locally on my machine. The build generates all files and sourcemaps, and uploads correctly to Sentry once the build completes. I'm unsure why the same command would work locally, but fail in Github Actions. Any help would be appreciated, thank you.

lforst commented 1 month ago

Hi, thanks for writing in! Can you please share a complete reproduction setup so we can debug this effectively? Thanks!

In addition to the repro, why are you using the webpack plugin + the nuxt SDK? Nuxt is vite right?

mdwyer-od commented 1 month ago

@lforst Nuxt can be used with webpack, as that's how this project was initially set up. I hope to move to Vite soon, but this is how I'm stuck for now.

What do you require for a complete reproduction? Does it need to be on something like codepen, or will supplying files directly here suffice?

lforst commented 1 month ago

Something that we could run would be great.

mdwyer-od commented 1 month ago

@lforst here's a basic reproduction of my setup. Though, when plugging in all my Sentry details, it doesn't seem to generate sourcemaps at all in Github. Locally, it works correctly generating sourcemaps and uploading them. I'm unsure why it's different, and I don't believe I'm missing any variables. Perhaps my Sentry configuration is incorrect in some way. I'll continue to look, but this should at least get you started.

lforst commented 1 month ago

It seems like you added the @sentry/webpack-plugin dependency but you're not using it anywhere. As far as I can see you are using @nuxtjs/sentry to upload sourcemaps which is not maintained by Sentry but the community. I recommend you raise an issue there!

getsantry[bot] commented 3 hours ago

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you remove the label Waiting for: Community, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀