serverless-bundle
serverless-bundle copied to clipboard
How make sourcemaps run...
I lost my day on it, so I share it here. I was not able to have sourcemaps working. For making them work, you have to install 'source-map-support', then import at top of your entrypoint import 'source-map-support/register';
I don't get why this is not mentioned in the doc...
hoping it will help somebody else
Hey @TheMechanic,
Just as an addition I tried this for typescript and although it was a bit more readable it didn't report the correct line numbers
@TheMechanic @Dashue I think it could be useful if you added a bit more details on your errors, with like a screenshot of the error or something similar. That would either help other people help you, or allow people to see if they have the same errors that you experience.
I didn't have to add import 'source-map-support/register';
in any of my handlers, although, I had to set the NODE_OPTIONS environment variables like so:
environment: {
NODE_OPTIONS: "--enable-source-maps",
},
With that, the source maps seem to at least be used. Although, since the code is minified, the stacktraces aren't much more useful... I wonder if this is expected or not.
With sourcemaps enabled:
Without sourcemaps enabled:
@louislatreille There is a significant performance impact for using --enable-source-maps
instead of import 'source-map-support/register'
which is still unresolved.
I too am struggling to get serverless-bundle
to solve the sourcemap problem with little intervention. I wouldn't need to include in the lambda zip if I could upload them to Sentry automatically...