diff --git a/packages/bundler-plugin-core/src/debug-id-upload.ts b/packages/bundler-plugin-core/src/debug-id-upload.ts index 2bca52c2..4de1aaa6 100644 --- a/packages/bundler-plugin-core/src/debug-id-upload.ts +++ b/packages/bundler-plugin-core/src/debug-id-upload.ts @@ -6,6 +6,7 @@ import { promisify } from "util"; import { SentryBuildPluginManager } from "./build-plugin-manager"; import { Logger } from "./logger"; import { ResolveSourceMapHook, RewriteSourcesHook } from "./types"; +import { stripQueryAndHashFromPath } from "./utils"; interface DebugIdUploadPluginOptions { sentryBuildPluginManager: SentryBuildPluginManager; @@ -15,7 +16,10 @@ export function createDebugIdUploadFunction({ sentryBuildPluginManager, }: DebugIdUploadPluginOptions) { return async (buildArtifactPaths: string[]) => { - await sentryBuildPluginManager.uploadSourcemaps(buildArtifactPaths); + // Webpack and perhaps other bundlers allow you to append query strings to + // filenames for cache busting purposes. We should strip these before upload. + const cleanedPaths = buildArtifactPaths.map(stripQueryAndHashFromPath); + await sentryBuildPluginManager.uploadSourcemaps(cleanedPaths); }; } diff --git a/packages/integration-tests/utils/create-cjs-bundles.ts b/packages/integration-tests/utils/create-cjs-bundles.ts index b230ccab..bc60ce2b 100644 --- a/packages/integration-tests/utils/create-cjs-bundles.ts +++ b/packages/integration-tests/utils/create-cjs-bundles.ts @@ -77,6 +77,7 @@ export function createCjsBundles( output: { path: path.join(outFolder, "webpack4"), libraryTarget: "commonjs", + filename: "[name].js?[contenthash]", }, target: "node", // needed for webpack 4 so we can access node api plugins: [sentryWebpackPlugin(sentryUnpluginOptions)],