Skip to content

fix: build Web Functions for arm64 - #9379

Merged
seshubaws merged 2 commits into
aws:developfrom
seshubaws:fix/web-function-arm64
Oct 28, 2026
Merged

seshubaws merged 2 commits into
aws:developfrom
seshubaws:fix/web-function-arm64

Conversation

@seshubaws

Copy link
Copy Markdown
Contributor

Which issue(s) does this change fix?

#9378

Why is this change necessary?

Lambda Web Functions run only on arm64 (docs), but WebFunction.architecture returned x86_64. sam build therefore produced x86_64 native dependencies (and pulled the latest-x86_64 image with --use-container), which fail to load at runtime.

How does it address the issue?

WebFunction.architecture now returns arm64. Build graph, workflow selection, and container image selection all read this property, so no other source changes are needed. Unit tests updated.

Verified with the repro from the issue (sharp dependency, --use-container): the build uses build-nodejs24.x:latest-arm64, produces sharp-linux-arm64, and the deployed Web Function returns {"ok":true,"arch":"arm64"}.

What side effects does this change have?

Web Functions built on x86_64 hosts without --use-container now hit the same cross-architecture handling as an AWS::Serverless::Function with Architectures: [arm64].

Mandatory Checklist

PRs will only be reviewed after checklist is complete

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Lambda Web Functions run only on arm64, but WebFunction.architecture
returned x86_64, so sam build produced x86_64 native dependencies
(and used the latest-x86_64 image with --use-container).

Fixes aws#9378
@seshubaws
seshubaws requested a review from a team as a code owner October 28, 2026 18:49
reedham-aws
reedham-aws previously approved these changes Oct 28, 2026
@aws-sam-tooling-bot

aws-sam-tooling-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

🧪 Hands-on test: No problems observed in 5 scenarios

Commit 5a11533 · build LambdaToolingHandsOn-Docker:e03abbfb-506e-46f7-b258-870dfa239d06. The plan's scenarios ran on an isolated build host; a problem is reported only if it reproduced at least twice. Passing scenarios show only that these checks behaved as expected, not that the change is correct.

Scenarios

Scenario Planned check Result Runner's note
S1 Run the unit tests the PR changes or depends on: WebFunction.architecture, the build definition architecture, and the n… ✅ pass Ran the 5 planned unit test files on head in /work/scratch/venv-head (SAM_CLI_DEV=1 pip install -e '.[dev]'): 237 passed, exit 0. This includes the new test_warns_x86_64_host_web_function_without_sug…
S2 Main path: `sam build` without containers on a project with one Web Function and one regular Lambda function. The Web F… ✅ pass Note: the 'sam' on PATH is a system SAM CLI 1.169.0 (/usr/local/bin/sam), not the PR code. Runs 04/05/06 used it and never built WebFn on either tree, so they are invalid. The dev install provides 's…
S3 Edge case: a Web Function and an arm64 regular function with the same CodeUri. The Web Function must still get its own … ✅ pass WebFn and an arm64 ArmFn share CodeUri src/. Head: EXIT=0, two separate function_build_definitions with the same codeuri: ArmFn arm64 (handler index.handler) and WebFn arm64 (handler index.js, resour…
S4 Existing workflows keep working: run --cached and --parallel builds twice on the S2 project. The arm64 Web Function def… ✅ pass On the S2 project (head), 'samdev build --cached --parallel' ran from clean and then twice more: EXIT 0 every time. build.toml stays WebFn arm64 / PlainFn x86_64 across runs. The plan's 'Valid cache …
S5 Container build: --use-container must pick the arm64 build image for the Web Function. On an x86_64 host it must log th… ✅ pass Host is x86_64 with Docker 28.5.2 and no binfmt_misc arm64 emulation. Head 'samdev build WebFn --use-container' logs the new warning "Cross-architecture build detected: Building arm64 Web Function 'W…

🤖 Automated hands-on test — not a review approval · model claude-opus-5.5 · Kiro kiro-cli 2.33.1 · build LambdaToolingHandsOn-Docker:e03abbfb-506e-46f7-b258-870dfa239d06 · commit 5a11533

History (2)
Commit Result When (UTC) Build
5a11533 No problems observed 2026-10-28 20:36 LambdaToolingHandsOn-Docker:e03abbfb-506e-46f7-b258-870dfa239d06
72e70d5 Problems reproduced 2026-10-28 19:00 LambdaToolingHandsOn-Docker:a7554e0f-407e-4d4c-8fb4-03d0d9aa97f1

Web Functions run only on arm64, so suggest arm64 emulation or an arm64
host instead of changing the architecture in the template.
@seshubaws
seshubaws merged commit 52dbb8b into aws:develop Oct 28, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants