Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How make sourcemaps run... #298

Open
TheMechanic opened this issue Mar 22, 2022 · 3 comments
Open

How make sourcemaps run... #298

TheMechanic opened this issue Mar 22, 2022 · 3 comments

Comments

@TheMechanic
Copy link

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

@Dashue
Copy link

Dashue commented Mar 30, 2022

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

@louislatreille
Copy link

@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:
image

Without sourcemaps enabled:
image

@Jackman3005
Copy link

@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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants