Skip to content

Conversation

@dcabib
Copy link
Contributor

@dcabib dcabib commented Feb 9, 2026

Description

When using sam build --cached, Lambda functions that share the same manifest file (e.g., package.json) get duplicate dependency folders created in .aws-sam/deps/. Each build definition uses a UUID to generate the dependencies directory name, regardless of whether the manifest is identical. This wastes disk space significantly in projects with many functions sharing the same dependencies.

Changes

• Modified the naming strategy from UUID-based to a deterministic hash-based approach
• Dependencies folder name is now generated from manifest_hash + runtime + architecture
• Functions with the same manifest, runtime, and architecture share a single dependencies folder
• Existing cached dependencies folders (UUID-based) are cleaned up on the next build
• Backward compatible: if manifest_hash is empty, falls back to UUID-based naming

Testing

• Unit tests added and passing
make pr passes

Fixes #6732

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

@dcabib dcabib requested a review from a team as a code owner February 9, 2026 15:47
@github-actions github-actions bot added area/build sam build command pr/external stage/needs-triage Automatically applied to new issues and PRs, indicating they haven't been looked at. labels Feb 9, 2026
This fixes the PyInstaller build failure where zlib download might fail
due to HTTP redirects or server errors not being handled properly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build sam build command 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.

Sam build duplicates dependency packages even if they share the same manifest

1 participant