Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webpack plugin did not upload sourcemap when output.filename include contain a query #441

Closed
Jokcy opened this issue Nov 15, 2023 · 7 comments

Comments

@Jokcy
Copy link

Jokcy commented Nov 15, 2023

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

  1. use webpack plugin to upload sourcemap
  2. in output.filename add a query:
filename: `[name]${
                    isDev ? '' : '.[contenthash]'
                }.js?${APP_VERSION_QUERY_NAME}=${APP_VERSION}`,
  1. build use webpack, sentry did not upload sourcemap

Expected Result

sentry upload sourcemap

Actual Result

sentry did not upload sourcemap

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Nov 15, 2023
@lforst
Copy link
Member

lforst commented Nov 15, 2023

Thanks for reporting this. Maybe you have time to investigate why this is happening, if not we will take a look.

@Jokcy
Copy link
Author

Jokcy commented Nov 16, 2023

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.

@leonidlebedev
Copy link

leonidlebedev commented Dec 7, 2023

+1
same problem

my situation

filename: '[name].js?[contenthash]',

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Dec 7, 2023
@getsantry getsantry bot removed the status in GitHub Issues with 👀 Dec 11, 2023
@jtbandes
Copy link

jtbandes commented Mar 4, 2024

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:

new BannerPlugin({
raw: true,
include: /\.(js|ts|jsx|tsx|mjs|cjs)$/,
banner: (arg?: BannerPluginCallbackArg) => {
const debugId = arg?.chunk?.hash ? stringToUUID(arg.chunk.hash) : uuidv4();
return getDebugIdSnippet(debugId);
},
})

Inside webpack, this regexp gets tested against chunk.files, which in my case contains the full filename, e.g. foo.js?bar

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 Mar 4, 2024
@jtbandes
Copy link

jtbandes commented Mar 5, 2024

I was able to work around this issue by patching the regular expression to look like this:

  include: /\.(js|ts|jsx|tsx|mjs|cjs)(?:\?|$)/

@lforst
Copy link
Member

lforst commented Mar 5, 2024

@jtbandes Thanks for looking, it seems slightly risky for us to also match on queries in the end, I am not sure yet.

@AbhiPrasad
Copy link
Member

Seems like #597 resolves this - thanks for raising that @jtbandes. Closing for now then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Archived in project
Development

No branches or pull requests

5 participants