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)
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`
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