cdklabs / cdklabs/construct-hub
Ensure Lambda Bundles are of expected size
- Dominant language
- TypeScript
- Stars
- 239
- Forks
- 30
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 11
Description
### Description
The handlers for a number of Lambda Function are larger than they need to be. Smaller bundles mean a shorter cold start time. In the past some of these were also unintentionally bundling `aws-cdk-lib` which will cause the handler size to be very large (10mb to 50mb) and bundle potentially disruptive dependencies. This has already caused issues in the past but was never rolled out to any bundles other than the transliteration one from the original incident.
We need to make some effort to ensure bundle sizes are minimal and add checks to ensure they stay like this.
- Only include aws-sdk v3 client packages that are actually needed
- Always exclude `aws-cdk-lib` from bundling so that code fails fast if used
- Add checks to the build system that ensure all bundles are within expected parameters, fail otherwise
### Use Case
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.