sentry-cli icon indicating copy to clipboard operation
sentry-cli copied to clipboard

Confirmation of sourcemap --url-prefix behaviour - possible bug

Open grug opened this issue 2 years ago • 3 comments

Environment

How do you use Sentry?

  • Sentry SaaS

Which SDK and version? JavaScript/React version 7.6.0

Info

I'm not sure if this is a bug or not so I'll try to describe the behaviour as best I can.

Our web application is accessible from https://kenya.elephantprimarycare.com/shell/inventory but because of how the application is routed at a network level (via istio), static assets are retrieved via https://kenya.elephantprimarycare.com/mfe/inventory/<path-to-resource> (i.e. https://kenya.elephantprimarycare.com/mfe/inventory/64.a9ebb12518bdd6fc18bec32feb47daf8.map which you can access through your browser right now and pull down one of our sourcemaps).

Does this mean that if we upload sourcemaps using the following command:

sentry-cli releases files $SENTRY_RELEASE upload-sourcemaps dist --decompress --url-prefix '~/mfe/inventory'

Assuming that the build directory is indeed dist and that all JS files and their corresponding sourcemaps are inside here, would you expect that uploads of the sourcemaps to Sentry should be fine?

When running the CLI, I get the following set of warnings:

image

Am I missing something here or is a bug happening?

grug avatar Jul 14 '22 15:07 grug

The report entries should already include url prefix that you used, so it should rather say something like:

~/mfe/inventory/103.11.js (sourcemap at /mfe/inventory/103.11.map)

Is this report coming from the actual call you mentioned above?

Also in regards to the original question, with the links you provided and based on the cli call/report, it should work just fine if you feed ith with ~/mfe/inventory prefix.

kamilogorek avatar Jul 25 '22 12:07 kamilogorek

Hey @kamilogorek - yep the report is coming from the call I mentioned above. It's interesting because the first line for each source file seems correct - as in, it shows the source file and the corresponding sourcemap file. However, I'm not sure why it's throwing up warnings on the following lines. Is there a chance that things are working correctly, but the warning is incorrectly showing?

grug avatar Jul 26 '22 14:07 grug

Excuse my late response. Got quite busy.

Is there a chance that things are working correctly, but the warning is incorrectly showing?

Yes, sourcemap reference logs are for the old --sourcemap-reference flag, which is now on by default (and there is --no-sourcemap-reference instead).

It's used for adding a sourcemap location as the part of request header, which is first detected via few patterns matching in your projects directory. This feature is necessary for sourcemaps resolution to work when one is using hidden-source-map, as this option is not adding //# sourceMappingURL= to your files.

ref: https://github.com/getsentry/sentry-cli/blob/c7f85ab84752865a2f1d44339eba6a5e0d3ce794/src/utils/sourcemaps.rs#L100-L147

kamilogorek avatar Aug 04 '22 12:08 kamilogorek

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar Aug 26 '22 00:08 github-actions[bot]