From 1cf484a699504a8e9d1ce8d692bcce1619e100dd Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Mon, 6 Oct 2025 17:30:08 +0200 Subject: [PATCH 1/2] fix: Strip query strings from asset paths --- packages/bundler-plugin-core/src/debug-id-upload.ts | 5 ++++- packages/integration-tests/utils/create-cjs-bundles.ts | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/bundler-plugin-core/src/debug-id-upload.ts b/packages/bundler-plugin-core/src/debug-id-upload.ts index 2bca52c2..9b696214 100644 --- a/packages/bundler-plugin-core/src/debug-id-upload.ts +++ b/packages/bundler-plugin-core/src/debug-id-upload.ts @@ -15,7 +15,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((p) => p.split("?")[0] || p); + 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)], From 21aec5674d3d8c9d52726655a423dd73bddbac2a Mon Sep 17 00:00:00 2001 From: Tim Fish Date: Thu, 9 Oct 2025 12:20:09 +0200 Subject: [PATCH 2/2] PR review --- packages/bundler-plugin-core/src/debug-id-upload.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/bundler-plugin-core/src/debug-id-upload.ts b/packages/bundler-plugin-core/src/debug-id-upload.ts index 9b696214..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; @@ -17,7 +18,7 @@ export function createDebugIdUploadFunction({ return async (buildArtifactPaths: string[]) => { // 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((p) => p.split("?")[0] || p); + const cleanedPaths = buildArtifactPaths.map(stripQueryAndHashFromPath); await sentryBuildPluginManager.uploadSourcemaps(cleanedPaths); }; }