Javascript Sourcemap upload to sentry.io
aheissenberger opened this issue · 9 comments
Are there any plans to support the upload of javascript sourcemaps?
https://docs.sentry.io/clients/javascript/sourcemaps/
I user webpack & uglify on my project and this would help to show the original source code on exceptions
Is not possible at the moment as sentry.io does not support this for node :-(
getsentry/sentry#2632
I tried to upload thru the sentry cli and tested with webpack devtool: 'source-map'
and devtool: 'inline-source-map'
but nothing worked as this feature is deactivated for node project globally
i was looking into source map upload originally but it doesn't seem to be possibly in Sentry yet. It would be a great feature and shouldn't be difficult to implement on the plugin side. However, it would need support by Sentry / raven-node itself. Did you already file a feature request with them?
it is on the road map of sentry.io but they have to rewrite part of there code (getsentry/sentry#2632 (comment)) which is now primarily focused on browser based source maps
I implemented an experimental branch supporting sourcemap uploads here https://github.com/esetnik/serverless-sentry-plugin/tree/feature/sourcemaps. It's currently working for my project setup and I'd be happy to PR it after it gets some testing by others. In order to activate sourcemap upload in my branch you need to pass uploadSourcemaps: true
in the plugin configs.
The downside is that there doesn't appear to be any way to upload sourcemaps in bulk (at least I can't find a sentry api for it) so each one is uploaded manually. This means it can take quite a long time if you include node_modules
. I've seen sentry's servers fail several times during the upload process. I tried to implement some rate limiting but I have no idea what their rules are so I'm just guessing.
@esetnik Have a look at my fork https://github.com/aheissenberger/serverless-sentry-plugin/tree/feature/upload-sourcemaps
which supports uploads with sentry-cli and the new Sentry Unified Node.js SDK.
Sourcemaps need to be part of the zip created for upload to AWS.
I use serverless-webpack which leads to only 2 files per handler.
Actually I like your approach of using the official cli better. Especially the fact that you can pass --validate
whereas the api does not offer such functionality. I will test it out and report back.
I found this option when looking into the code of the official webpack plugin:
https://github.com/getsentry/sentry-webpack-plugin
I tried to add it but failed to provide the related information programatically at the step in the Serverless pipeline.
I still think that integrating this better with serverless-webpack-plugin would be the best option.
@aheissenberger I took your code and got it to work with a few modifications.
Well not completely working because the file mapping inside of sentry isn't working. While sentry it self shows me that the artifacts are correctly uploaded and prefixed, it says Source code was not found
.
How did you get the new SDK to work?