Sourcemaps via sentry-cli not working

We are trying to get sourcemaps working using the sentry-cli, but so far no luck.
I am using the sentry-cli with just:
sentry-cli releases -p "PROJECT_NAME" files "$SENTRY_RELEASE" upload-sourcemaps ./sourcemaps/buildfiles/build
Issues show up with line references like:

/cdn/static/build/StudentProfile.script.00f5da004e73c5d97542.js in Object.onChange at line 1:80824

The log for the above command shows:

    ~/StudentProfile.script.00f5da004e73c5d97542.js (sourcemap at StudentProfile.script.00f5da004e73c5d97542.js.map)

I have tried a combination of options including --strip-common-prefix and --url-prefix, but nothing has worked.

For example using --url-prefix=~/cdn/static/build yields this in the log:

    ~/cdn/static/build/StudentProfile.script.00f5da004e73c5d97542.js (sourcemap at StudentProfile.script.00f5da004e73c5d97542.js.map)

But it still did not work.

Is there a way to see what it is looking for?

Are you able to verify that the sourcemaps are uploaded to your instance?

Yes, I can see them in the Sentry admin for the project release.
They show up like:

    ~/StudentProfile.script.00f5da004e73c5d97542.js.map

Have you followed our troubleshooting guide for sourcemaps?

I have been going through it and found that I did not have the release set up, I have added that in but still not seeing them.

I am unsure about what is required here:

https://docs.sentry.io/platforms/javascript/sourcemaps/troubleshooting_js/#verify-sourcemappingurl-is-present

I am using hidden-sourcemaps so the sourcemappingurl is not in my code but I am using the sentry-cli to upload the sourcemap which I thought would take care of adding the needed SourceMap header on the uploaded file. As per: [feature-request] support hidden sourcemaps · Issue #4708 · getsentry/sentry · GitHub It seems like this should be supported?

So, here is an example. I have an error with this in the stack trace:

* `/cdn/static/build/vendors~website.script.be7c87025af35a407e13.js` at line `1`

The abs_path is set as: https://www.wayup.com/cdn/static/build/vendors~website.script.be7c87025af35a407e13.js

The release is set as: cc6385c534b3c53335b63c12a594c7e8e52e9c56

I go to find that release’s sourcemaps and find:

~/vendors~website.script.be7c87025af35a407e13.js
and
~/vendors~website.script.be7c87025af35a407e13.js.map

But there is no sourcemap showing in the stack trace itself. Is there something else I can look at to troubleshoot?

If your stacktrace points to /cdn/static/build/file.js, then uploaded artifacts need to match this path.

--url-prefix
This sets an URL prefix in front of all files. This defaults to ~/ but you might want to set this to the full URL. This is also useful if your files are stored in a sub folder. eg: --url-prefix '~/static/js'

In your case you need to upload them with a flag --url-prefix ~/cdn/static/build

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.