You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
sentryWebpackPlugin makes webpack forget content hashes #680
Hi, thanks for writing in! Can you please share a minimal reproduction that we can use to investigate this?
Without a full picture, my best guess would be that our plugin injects something that changes on every build dynamically, for instance the release or debugIds.
Thanks for providing the reproduction! I can in fact reproduce this locally. in the sense that both the main.* and other.* assets get different hashes when adjusting console logs.
First off: It seems fairly logical to me that the main.* hash changes because the changed console.log from other.js gets pulled into the main. bundle.
Your Webpack plugin config is outdated, probably from a time where you used version 1 of the plugin(?). Here's an updated version:
plugins: [sentryWebpackPlugin({project: "hbbtv-client",org: "sveriges-television",release: {name: process.env.VERSION||"1.0.0",// <--- `release.name` is the new `release`}sourcemaps: {// <-- you probably don't need to set this at all, as we auto detect assets since v2assets: ["dist"],},// dryRun: true, // <-- no longer available}),],
As you can see, the release name property shifted, which meant that the plugin couldn't determine a set release name so it fell back to either an environment variable or the git commit sha to set it. This release value gets injected into every bundle. So this likely introduced randomness that led to changes in all files.
We also further inject a debug id snippet with a unique ID for each file. I think this should be deterministic as long as no file changes occur (cc @lforst to confirm) but likely there was interplay with the release.
I recommend updating your config and checking if you still get different hashes in places where you wouldn't expect this.
Note that I didn't reproduce this on Gitlab yes because frankly, if I can avoid creating yet another account I'll do that 😅
Thank you! That, along with the correct project and auth key, solved the issue. I find it a bit strange that a misconfiguration in the Sentry setup caused the content hashes to change. Is it supposed to work this way? If so, would it be a bad idea to show a warning about it?
Glad it works for you now! I'll close this issue as completed then but I'll raise the question of checking/validating configs better.
My 2 cents around this are that it's very hard to check against properties being set that we don't expect (as per our current type definition). Maybe we can special-case some known properties like include or a string value for release.
Worth noting that we already check against misconfiguration of known properties (e.g. invalid/malformed auth tokens).
@Lms24 No, I don't think this is solved. Since your plugin breaks the content hashes when things are misconfigured. At least a warning would be good for the end user right?
Imagine how many cashes get busted and the amount of extra internet traffic this generates since files don't get cached anymore.
Thanks for the feedback. We'll keep it in mind. Currently we don't plan on changing anything. I hope this doesn't sound dismissive - it's a matter of prioritization
I'm running into this same issue as well. We have a vendor chunk that we want to be long-lived, so we want Sentry to use @sentry/webpack-plugin to upload the source maps to sentry. But we don't want the vendor chunk to cache-busted with each deploy (since right now the deploys include the sha which changes each time).
Activity
Lms24 commentedon Feb 19, 2025
Hi, thanks for writing in! Can you please share a minimal reproduction that we can use to investigate this?
Without a full picture, my best guess would be that our plugin injects something that changes on every build dynamically, for instance the release or debugIds.
Removing what?
josefnorlin commentedon Feb 19, 2025
Here's a minimal reproduction:
https://github.com/josefnorlin/sentry-webpack-repro
And run it on a Gitlab CI/CD process (since this is no problem running locally):
`// plugins: [
// sentryWebpackPlugin({
// project: "XXX",
// org: "XXX",
// release: process.env.VERSION || "1.0.0",
// include: "./dist",
// dryRun: true, // Set to true for testing without uploading
// }),
// ],`
My short reference above to "Removing, makes it work again:" was to comment away those lines above.
Hope this clarifies things.
Lms24 commentedon Feb 19, 2025
Thanks for providing the reproduction! I can in fact reproduce this locally. in the sense that both the
main.*andother.*assets get different hashes when adjusting console logs.First off: It seems fairly logical to me that the
main.*hash changes because the changed console.log fromother.jsgets pulled into themain.bundle.Your Webpack plugin config is outdated, probably from a time where you used version 1 of the plugin(?). Here's an updated version:
As you can see, the release name property shifted, which meant that the plugin couldn't determine a set release name so it fell back to either an environment variable or the git commit sha to set it. This release value gets injected into every bundle. So this likely introduced randomness that led to changes in all files.
We also further inject a debug id snippet with a unique ID for each file. I think this should be deterministic as long as no file changes occur (cc @lforst to confirm) but likely there was interplay with the release.
I recommend updating your config and checking if you still get different hashes in places where you wouldn't expect this.
Note that I didn't reproduce this on Gitlab yes because frankly, if I can avoid creating yet another account I'll do that 😅
josefnorlin-svt commentedon Feb 25, 2025
Thank you! That, along with the correct project and auth key, solved the issue. I find it a bit strange that a misconfiguration in the Sentry setup caused the content hashes to change. Is it supposed to work this way? If so, would it be a bad idea to show a warning about it?
josefnorlin-svt commentedon Feb 25, 2025
I've updated the code to better split concerns of main.js (index.js) and other.js (other.js) file to better show this in the project linked here:
https://github.com/svt/sentry-webpack-repro
Lms24 commentedon Feb 26, 2025
Glad it works for you now! I'll close this issue as completed then but I'll raise the question of checking/validating configs better.
My 2 cents around this are that it's very hard to check against properties being set that we don't expect (as per our current type definition). Maybe we can special-case some known properties like
includeor a string value forrelease.Worth noting that we already check against misconfiguration of known properties (e.g. invalid/malformed auth tokens).
josefnorlin-svt commentedon Feb 28, 2025
@Lms24 No, I don't think this is solved. Since your plugin breaks the content hashes when things are misconfigured. At least a warning would be good for the end user right?
Imagine how many cashes get busted and the amount of extra internet traffic this generates since files don't get cached anymore.
lforst commentedon Mar 3, 2025
Thanks for the feedback. We'll keep it in mind. Currently we don't plan on changing anything. I hope this doesn't sound dismissive - it's a matter of prioritization
axelson commentedon Jul 11, 2025
I'm running into this same issue as well. We have a vendor chunk that we want to be long-lived, so we want Sentry to use
@sentry/webpack-pluginto upload the source maps to sentry. But we don't want the vendor chunk to cache-busted with each deploy (since right now the deploys include theshawhich changes each time).Or maybe at least this behavior can be mentioned here: https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/webpack/
Is there a workaround? Could we upload the source maps without using the plugin?
GrinZero commentedon Sep 16, 2025
The injection of Sentry causes 100% invalidation of the user's cache every time we update it, which is a very serious issue.