Open julianCast opened 2 months ago
Let's leave aside filesToDeleteAfterUpload
for a sec. In theory the Gatsby SDK already adds the sentryWebpackPlugin
automatically. It's possible that the plugin you add yourself clashes with the one that is added automatically.
Can you try simply disabling the automatic adding of the plugin like we suggest here:
I would do that as a first step and then see what the logs look like!
It's possible that the plugin you add yourself clashes with the one that is added automatically.
Very good observation, what I didn't mention (to not add too much details), is that I'm using yarn patch "@sentry/gatsby@npm:8.28.0"
to modify mentioned package locally, this is the patch:
diff --git a/gatsby-node.js b/gatsby-node.js
index d60914a03061ef4599b2848abba44918cd5e1ece..ee7ff0f4e7773dd00b4c12f32049d0a42f4621e0 100644
--- a/gatsby-node.js
+++ b/gatsby-node.js
@@ -12,12 +12,14 @@ exports.onCreateWebpackConfig = ({ getConfig, actions }, options) => {
sentryWebpackPlugin({
sourcemaps: {
// Only include files from the build output directory
- assets: ['public'],
+ assets: ['./public/**'], // Workaround for Sentry not being able to find sourcemap files in the folder without glob pattern during building.
+ filesToDeleteAfterUpload: "./public/**/*.map",
// Ignore files that aren't users' source code related
ignore: [
'polyfill-*', // related to polyfills
'framework-*', // related to the frameworks (e.g. React)
'webpack-runtime-*', // related to Webpack
+ '**/~partytown/**', // Specific to partytown
],
},
// Handle sentry-cli configuration errors when the user has not done it not to break
(Just leaving this reply to satisfy our internal issue response tracking tool)
Hi, This will be fixed via #13592
Neat! One less thing for our yarn patch. Regarding the other issue (filesToDeleteAfterUpload), any idea why/how is that happening?
✅
Use gatsby webpack-plugin and parameter filesToDeleteAfterUpload. Source maps won't be fully uploaded. ❌
Use gatsby webpack-plugin without parameter filesToDeleteAfterUpload. Source maps will be fully uploaded.
Did you try disabling the webpack plugin from our Gatsby package in favour of the one you added as suggested here?
Did you try disabling the webpack plugin from our Gatsby package in favour of the one you added as suggested here?
Same exact output as before :( , I have the logs but they are the same as in the description. I changed this:
If I just remove filesToDeleteAfterUpload
no source maps errors, but not source maps removed.
Let me know If I can provide anything else
Hi, I could reproduce your problem. My hunch is that gatsby is reusing the plugin for 2 build stages and the maps for stage 2 are deleted by the plugin from stage 1 or something like that.
My recommendation for now is to not use the filesToDeleteAfterUpload
option and instead delete the sourcemaps by yourself after your build is done.
I will backlog this issue.
This would ease the workflow whenever we want to use filesToDeleteAfterUpload
https://github.com/getsentry/sentry-javascript/pull/13610
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/gatsby
SDK Version
8.28.0
Framework Version
React 18.3.1, Gatsby 5.11, webpack-plugin 2.22.3
Reproduction Example/SDK Setup
gatsby-node.js
Netlify logs
Steps to Reproduce
✅
filesToDeleteAfterUpload
.❌
filesToDeleteAfterUpload
.Expected Result
Source maps fully uploaded to Sentry with errors traceable.
Actual Result
No source maps neither on Server or Sentry.