aws_lambda_nodejs: exclude node_modules option from sourcemaps #28088
Labels
@aws-cdk/aws-lambda-nodejs
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p2
Describe the feature
Excluding sourcemaps and shipping them to your third-party provider is great, but for Lambdas using CloudWatch, you have to include them to get meaningful traces.
It is possible to exclude node_modules sourcemaps to drastically save on final zip size.
Use Case
Reduce lambda cold starts without sacraficing on the sourcemaps for your own code, which should be enough to properly debug in 90% of the cases.
Proposed Solution
This PR shows an improvement from 34K to 2.2K for the sourcemap file.
Esbuild plugins do not work in sync mode, only async. I know we can not do async work in the try bundle, but there are ways around it 😅, using deasync. Yes this is a controversial package and should not be used in any production runtime code, but seeing as this happens on build time, I feel it is an acceptable "risk" worst case the user can disable the flag if there is really an issue.
You can see it in action in this Gist I proposed some time ago.
Other Information
No response
Acknowledgements
CDK version used
Environment details (OS name and version, etc.)
The text was updated successfully, but these errors were encountered: