sentry-javascript-bundler-plugins
sentry-javascript-bundler-plugins copied to clipboard
webpack plugin did not upload sourcemap when output.filename include contain a query
Environment
What version are you running? Etc.
"@sentry/webpack-plugin": "^2.10.0", "@sentry/browser": "7.80.1", "@sentry/tracing": "7.80.1",
Steps to Reproduce
- use webpack plugin to upload sourcemap
- in
output.filenameadd a query:
filename: `[name]${
isDev ? '' : '.[contenthash]'
}.js?${APP_VERSION_QUERY_NAME}=${APP_VERSION}`,
- build use webpack, sentry did not upload sourcemap
Expected Result
sentry upload sourcemap
Actual Result
sentry did not upload sourcemap
Thanks for reporting this. Maybe you have time to investigate why this is happening, if not we will take a look.
Thanks for reporting this. Maybe you have time to investigate why this is happening, if not we will take a look.
I'm not familiar with the native part of the cli, I may make a repo that reproduce this issue to help you to investigate.
+1 same problem
my situation
filename: '[name].js?[contenthash]',
I am having a similar problem. The errors I'm getting are
[sentry-webpack-plugin] Debug: Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: [...]/packages/web/.webpack/.assets/1080.c5621104137b49ba10db.js
I believe this is occurring because this injection code only works if the path ends with .js: https://github.com/getsentry/sentry-javascript-bundler-plugins/blob/bbe047289daeb2373ed29c1fdd264927668ac4e4/packages/webpack-plugin/src/index.ts#L106-L113
Inside webpack, this regexp gets tested against chunk.files, which in my case contains the full filename, e.g. foo.js?bar
I was able to work around this issue by patching the regular expression to look like this:
include: /\.(js|ts|jsx|tsx|mjs|cjs)(?:\?|$)/
@jtbandes Thanks for looking, it seems slightly risky for us to also match on queries in the end, I am not sure yet.
Seems like https://github.com/getsentry/sentry-javascript-bundler-plugins/pull/597 resolves this - thanks for raising that @jtbandes. Closing for now then.