construct-hub icon indicating copy to clipboard operation
construct-hub copied to clipboard

Ensure Lambda Bundles are of expected size

Open mrgrain opened this issue 1 year ago • 0 comments

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

mrgrain avatar Sep 18 '24 10:09 mrgrain