Skip to content

fix: correct module path mapping for ZIP deployment#94

Open
naumaanh wants to merge 2 commits intoawslabs:mainfrom
naumaanh:main
Open

fix: correct module path mapping for ZIP deployment#94
naumaanh wants to merge 2 commits intoawslabs:mainfrom
naumaanh:main

Conversation

@naumaanh
Copy link
Copy Markdown

Issue #93 :ZIP deployment fails with HTTP 424 "Runtime initialization time exceeded"

Description of changes:
When using deployment_type: zip, the agent crashes on startup with ModuleNotFoundError which surfaces asHTTP 424 "Runtime initialization time exceeded"in the UI.

The ZIP packager in backend-stack.ts was pointing at the wrong source folders and missing one entirely, so the Python modules the agent imports at startup simply weren't included in the ZIP. Docker worked fine because it has explicit COPY commands mapping the right folders. The ZIP packager was not replicating that mapping.

A secondary issue meant CloudFormation wouldn't push an updated ZIP to the running Runtime on redeploy because the Runtime resource definition never changed (same S3 bucket, same key), so it left the Runtime running the old artifact.

The fix was replacing a generic loop with explicit directory reads that mirror the Dockerfile COPY commands. Also embeds a short fingerprint of the ZIP contents in the Runtime description so CloudFormation detects a real change and re-deploys the Runtime whenever the ZIP is updated.

Docker deployments are unaffected, the changed code only runs inside the if (deploymentType === "zip") block.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Hassan and others added 2 commits April 19, 2026 12:54
The ZIP packager was reading the wrong source directories when building
the deployment artifact, causing ModuleNotFoundError crashes at runtime.
Also fixes AgentCore Runtime not picking up updated ZIPs on redeploy.
@naumaanh naumaanh requested a review from a team April 19, 2026 18:30
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.

1 participant