Skip to content

Conversation

@bchampp
Copy link
Member

@bchampp bchampp commented Dec 3, 2025

Which issue(s) does this change fix?

Why is this change necessary?

We found a bug in the latest release of SAM CLI in the emulator creation process. It seems to be only affecting the Mac installer; we were able to test executions on Linux and Windows successfully.

The issue manifests like this:

Error: 400 Client Error for http+docker://localhost/v1.35/containers/0c3bf73e11a1f171988bfed82e8842bb4682cc07fe729fd2cc379cd8867ee0f8/start: Bad Request ("failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: exec: "/usr/local/bin/aws-durable-execution-emulator-arm64": stat /usr/local/bin/aws-durable-execution-emulator-arm64: no such file or directory: unknown")

The underlying issue is that while the binary itself exists in the artifacts for the release, they don't get copied into the container image properly.

How does it address the issue?

We need to create a new image from the base image (Ubuntu), and copy the emulator binaries into it, and then set the executable permissions on the emulator binary. This is the correct approach to the container image creation, and follows the pattern that the lambda container uses when generating the runtime images to run the function code.

I validated it by running the pyinstaller script manually and symlinked the build output artifacts to run an execution:

sudo mkdir -p /usr/local/aws-sam-cli
sudo cp -r pyinstaller-output/dist/* /usr/local/aws-sam-cli/
sudo ln -sf /usr/local/aws-sam-cli/sam /usr/local/bin/sam

✗ sam --version
SAM CLI, version 1.151.0

✗ sam local execution get asdf
Error: An error occurred (404) when calling the GetDurableExecution operation: Execution asdf not found

✗ sam local invoke HelloWorld --container-host-interface 0.0.0.0
No current session found, using default AWS::AccountId
Invoking hello-world.handler (nodejs22.x)
Local image was not found.
Removing rapid images for repo public.ecr.aws/sam/emulation-nodejs22.x
Building image............
Using local image: public.ecr.aws/lambda/nodejs:22-rapid-x86_64.

START RequestId: 362138ee-0799-43ac-80e7-99c9b735de9b Version: $LATEST
2025-12-03T06:45:52.408Z	c96df452-41be-4c95-aff1-5cf13429a6b6	INFO	Hello world from a durable function!
END RequestId: c96df452-41be-4c95-aff1-5cf13429a6b6
REPORT RequestId: c96df452-41be-4c95-aff1-5cf13429a6b6	Init Duration: 0.74 ms	Duration: 1804.98 ms	Billed Duration: 1805 ms	Memory Size: 128 MB	Max Memory Used: 128 MB

Execution Summary:
=========================
ARN:      041f8d1e-e762-414c-8bce-ed0339a2320c
Name:     N/A
Duration: 1.92s
Status:   SUCCEEDED ✅
Input:    {}
Result:   "Hello World!"

Commands you can use next
=========================
[*] Get execution details: sam local execution get 041f8d1e-e762-414c-8bce-ed0339a2320c
[*] View execution history: sam local execution history 041f8d1e-e762-414c-8bce-ed0339a2320c

What side effects does this change have?

None.

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.

@bchampp bchampp requested a review from a team as a code owner December 3, 2025 07:26
@github-actions github-actions bot added area/local/start-api sam local start-api command area/local/invoke sam local invoke command area/local/start-invoke pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Dec 3, 2025
@valerena valerena changed the title fix: build emulator image and copy binary to it fix: build durable emulator image and copy binary to it Dec 3, 2025
@valerena valerena added this pull request to the merge queue Dec 3, 2025
Merged via the queue into aws:develop with commit c3d64cd Dec 3, 2025
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/local/invoke sam local invoke command area/local/start-api sam local start-api command area/local/start-invoke pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants