fix(aws-lambda): match the shell to its own pin, ship only hashed files, refuse the shell ZIP in CDK and SAM (#8173)

* fix(aws-lambda): match the shell to its own pin, ship only hashed files, refuse the shell ZIP in CDK and SAM

Review follow-ups to the pinned shell route:
- build-zip --source=chrome-headless-shell accepts the folder only when its
  digest is pinned for this version, not for any pinned build.
- It leaves out the files the digest skips (debug.log and chrome_debug.log,
  which Chrome writes as it runs), so nothing unhashed ships.
- The CDK construct throws on chromeSource "chrome-headless-shell" and the
  SAM template allows only sparticuz, as lambda deploy already refused it:
  a shell ZIP cannot fit a function. The CHROME_PATH wiring for that ZIP is
  gone with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(aws-lambda): raise the packed size budget to 82,000 bytes

The shipped build-zip script now checks the shell against its own
version's pin and skips the files the digest leaves out. That takes the
tarball to 81,378 bytes in CI, over the 80,500 budget's 1% tolerance;
main was already within about 200 bytes of it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
James Russo
2026-11-18 11:25:22 +00:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 9acf268680
commit 61d65e7177
10 changed files with 72 additions and 92 deletions
+1 -1
View File
@@ -200,7 +200,7 @@ with `--profile <name>` or `AWS_PROFILE=<name>`.
| `LambdaMemoryMb` | `10240` | Lambda memory; Lambda allocates CPU proportionally. 10 GB recommended for 1080p. |
| `LambdaTimeoutSec` | `900` | Per-invocation timeout. 15 min is Lambda's hard ceiling. |
| `ReservedConcurrency` | `-1` | Hard cap on simultaneous Lambda invocations. `-1` = unreserved. Set to e.g. `50` to bound cost. |
| `ChromeSource` | `sparticuz` | Must match the `--source=` flag passed to `build-zip.ts`; a shell ZIP is over Lambda's limit. |
| `ChromeSource` | `sparticuz` | Only `sparticuz`: a ZIP built with `--source=chrome-headless-shell` is over Lambda's limit. |
| `ChunkInvocationAlarmThreshold` | `1000` | CloudWatch alarm threshold (RenderChunk invocations per hour). |
## Cleanup
+4 -10
View File
@@ -49,13 +49,13 @@ Parameters:
ChromeSource:
Type: String
Default: sparticuz
AllowedValues: [sparticuz, chrome-headless-shell]
AllowedValues: [sparticuz]
Description: >-
Which Chrome runtime the bundled ZIP was built with. Must match the
`--source=` flag passed to `build-zip.ts`. The handler reads this
via the HYPERFRAMES_LAMBDA_CHROME_SOURCE env var at boot. A
chrome-headless-shell ZIP is over Lambda's unzipped limit today; the
arm64 video image always runs its own chrome-headless-shell.
via the HYPERFRAMES_LAMBDA_CHROME_SOURCE env var at boot. Only
sparticuz: a chrome-headless-shell ZIP is over Lambda's unzipped
limit, and the arm64 video image runs its own chrome-headless-shell.
ChunkInvocationAlarmThreshold:
Type: Number
@@ -77,7 +77,6 @@ Parameters:
Conditions:
HasReservedConcurrency: !Not [!Equals [!Ref ReservedConcurrency, -1]]
HasVideoFunction: !Not [!Equals [!Ref VideoImageUri, ""]]
BundlesChromeHeadlessShell: !Equals [!Ref ChromeSource, chrome-headless-shell]
Globals:
Function:
@@ -97,11 +96,6 @@ Globals:
Variables:
NODE_OPTIONS: "--enable-source-maps"
HYPERFRAMES_LAMBDA_CHROME_SOURCE: !Ref ChromeSource
# Where build-zip.ts --source=chrome-headless-shell puts the shell (BUNDLED_SHELL_PATH).
HYPERFRAMES_LAMBDA_CHROME_PATH: !If
- BundlesChromeHeadlessShell
- /var/task/chrome-headless-shell-linux64/chrome-headless-shell
- !Ref AWS::NoValue
Resources:
# ── S3 bucket for plan tarballs, chunk outputs, and final renders ───────