Repository navigation
fix(aws-lambda): chrome-headless-shell 158 in the arm64 video image, sparticuz 153 in the x86 ZIP - #8155
Conversation
The arm64 video image now installs Chrome for Testing's linux-arm64 chrome-headless-shell 158.0.8127.36, pinned by sha256 and fetched with curl -f, as the whole shell folder. The Lambda Node 22 base has none of the shared libraries the shell links and no fonts, so the image installs them from the base's repository at the same pinned release. The image sets HYPERFRAMES_LAMBDA_CHROME_SOURCE and HYPERFRAMES_LAMBDA_CHROME_PATH itself, and the nested video function no longer passes ChromeSource, which would override them. stage-arm64-image.ts stops fetching the sparticuz arm64 pack and drops the ZIP's x86 sparticuz Chrome instead. The x86 handler ZIP stays on @sparticuz/chromium, bumped from 148.0.0 to 153.0.0. It builds at 258,502,222 bytes unzipped, under Lambda's 262,144,000-byte limit and the 248 MiB in-house gate. Two fixes for --source=chrome-headless-shell: - build-zip.ts staged only the executable, which exits at launch without its ICU data and .pak files. It now stages the whole shell folder at chrome-headless-shell-linux64/. - Nothing set HYPERFRAMES_LAMBDA_CHROME_PATH, which src/chromium.ts requires for that source. The SAM template and the CDK stack now set it to the bundled shell when ChromeSource asks for it. Drops the unused @types/aws-lambda devDependency, which the dead-code audit reports whenever this package's manifest changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The video stage now installs Chrome's system libraries with microdnf, so it runs code for arm64. The pack job built that image on ubuntu-latest with no emulation, which it could do only while the stage copied files. A new lambda-video-image job builds it natively on ubuntu-24.04-arm, from the handler zip whose sha256 the zip job reported, and reports the OCI tarball's sha256. Pack downloads that tarball, checks the sha256 against the job's, and pins it as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Automations to automatically generate PRs for you. |
2573b12 to
5214b90
Compare
Edit accuracy: accurate 271 (base branch 271), smooth 63 of thoseThe gate passes. Quarantined, measured but not gated (0) Unstable (1)
|
chromium.ts loses the two doc lines on BUNDLED_SHELL_DIR and BUNDLED_SHELL_PATH; the names and the SAM template's comment already say what they are. @hyperframes/aws-lambda's unpacked budget goes from 290,508 to 298,000 bytes. The package unpacks to 295,324 bytes, up from the shared chrome-headless-shell staging module the ZIP and image scripts now import and from the README and docs that describe the two Chrome sources. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
887d792 to
3baaf5c
Compare
miguel-heygen
left a comment
There was a problem hiding this comment.
Summary. The arm64 video image moves to chrome-headless-shell 158, built natively on ubuntu-24.04-arm. The x86 ZIP stays on @sparticuz/chromium, bumped to 153. build-zip --source=chrome-headless-shell now stages the whole shell folder.
Strengths
- Every download on the release path is pinned and checked before unpacking:
- the arm64 shell zip by version and SHA-256 (
image/Dockerfile:45-53;sha256sum -cruns beforeunzip), and then the--versioncheck; - the base image by digest (
Dockerfile:4); - microdnf packages through
--releasever=2023.12.20260914; - x86 Chromium through the lockfile;
fetch.shchecks the SHA-256 or git commit beforetar(Rule 7 holds).
- the arm64 shell zip by version and SHA-256 (
- The image is built and checked by digest:
lambda-video-imageexports its OCI SHA-256, andpackrefuses any other (publish.yml:269-330). The arm runner is GitHub's standard one, free for a public repo. - CI runs the image on ARM, not only builds it (
lambda-arm64-image.yml:105-140). - No account ids, internal hosts or secrets in the diff.
Important
scripts/_chromeHeadlessShell.ts:30stages the newest Chrome in the Puppeteer cache, with no version or checksum check. A host that has 159 cached ships 159, even though the error text tells you to install 158. Check the version against158.0.8127.36and the folder's checksum. The PR body also says the folder (about 296 MB) can't fit a ZIP, so the SAM and CDKChromeSource=chrome-headless-shelloption it now wires up builds a ZIP that can never deploy. It should refuse up front, or its docs should say it's image-only.- Headroom: the sparticuz 153 ZIP is 258,502,222 bytes against a 260,046,848-byte gate (
build-zip.ts:81), so about 1.5 MB is left. Any dependency growth will fail the build at release time. Note the margin, or add a test that pins it. - No proof that renders match before and after. The smoke only checks that a 64 px green square screenshots to more than 0 bytes (
smoke-video.mjs:17-24), so it renders no text. The arm64 image installs onlyliberation-fonts, while sparticuz brings its own font set. CJK or emoji text could therefore render as boxes on arm64 while x86 looks fine. A frame compare of a mixed-script fixture, arm64 against x86, would settle it.
Verdict: approve, with items 1 to 3 as follow-ups.
Reasoning: the release path is pinned and verified end to end and runs on real ARM. The gaps are the unpinned fallback route, a thin size margin and no text-render comparison; none ships an unverified binary.
What
The arm64 Lambda video image now runs Chrome for Testing's chrome-headless-shell 158.0.8127.36, pinned by sha256. The x86 handler ZIP stays on
@sparticuz/chromium, bumped from 148 to 153. This PR also fixes the two bugs that kept--source=chrome-headless-shellfrom working, and moves the release workflow's arm64 image build onto an ARM runner.Why
The rest of the repo pins chrome-headless-shell 158 (#8145), but the Lambda functions were still on Chromium 148 from
@sparticuz/chromium.The shell can't go in the x86 ZIP. Its folder is about 296 MB, which is over Lambda's 262,144,000-byte unzipped limit, and xz or brotli compression still leaves it 4 to 7 MB over. So the x86 ZIP takes sparticuz's newest release, 153, which builds at 258,502,222 bytes unzipped. The arm64 video function is a container image, which has no such limit, so it gets the real 158 shell.
Related work
Follows #8145.
How
packages/aws-lambda/image/Dockerfile): the image installs the linux-arm64 shell folder withcurl -fand checks its sha256. The Lambda Node 22 base has none of the shell's shared libraries and no fonts, so thevideostage installs them withmicrodnfat a pinned Amazon Linux release. The image setsHYPERFRAMES_LAMBDA_CHROME_SOURCEandHYPERFRAMES_LAMBDA_CHROME_PATHitself. The nested video function no longer passesChromeSource, which would override them.stage-arm64-image.tsstops fetching the sparticuz arm64 pack.@sparticuz/chromium153.0.0 inbun.lockand the runtime lock. Theaudioandwarmactions also launch Chrome on this function, so they stay on sparticuz too.build-zip --source=chrome-headless-shell. It staged only the executable, which exits at launch with "Invalid file descriptor to ICU data". It now stages the whole shell folder.HYPERFRAMES_LAMBDA_CHROME_PATH.src/chromium.tsrequires it for the shell source, but nothing set it. The SAM template and the CDK stack now set it to the bundled shell whenChromeSourceasks for the shell..github/workflows/publish.yml):packbuilt the arm64 image onubuntu-latestwithout emulation, which worked only while thevideostage just copied files. The newmicrodnfstep runs arm64 code, so a newlambda-video-imagejob builds the image natively onubuntu-24.04-arm. Pack downloads the OCI tarball, checks its sha256 against that job's output, and pins it as before.@types/aws-lambdadevDependency is gone; the dead-code audit flags it whenever this manifest changes.Test plan
build-zip(whole shell folder staged),stage-arm64-image, the CDK stack snapshot (CHROME_PATHset only for the shell source), CLI deploy, andpublish-workflow(the image builds on ARM, and pack pins only the digest that job built). The new publish test fails against the old workflow.@hyperframes/aws-lambda: 277 pass. The 2image/fetch.test.tsfailures are local only: this machine's curl lacks--retry-all-errors, and this PR doesn't touch that file.src/commands/lambda: 105 pass.scripts/publish-workflow,publish-main-only-workflowsandrelease-lambda-assets: 48 pass.Lambda arm64 imageCI builds and smoke-runs the arm64 image on ARM. Its smoke handler reportsHeadlessChrome/158.0.8127.36, ffmpeg 7.0.2,arch: arm64and a non-empty screenshot.hyperframes lambda deploy --video-arch arm64with the CI-built image. The video function is an arm64 container image with no function-level Chrome variables, so the image's own shell settings apply. The render function is the x86_64 ZIP. The warm-up after deploy succeeded.lambda renderofproducer/tests/distributed/mp4-h264-sdr(640x360, 30 fps, 15-frame chunks): SUCCEEDED, 60/60 frames in 4beginframechunks, an h264 MP4 with 60 frames.lambda destroy, then the retained render bucket and the video log group by hand. Afterwards no stack, IAM role, ECR repository, bucket, function, state machine or log group from the run was left.🤖 Generated with Claude Code