Skip to content

fix(lambda): calculateLayersHash includes all stack layers - #36818

Closed
Abhinandansinha01 wants to merge 2 commits into
aws:mainfrom
Abhinandansinha01:fix/lambda-layer-hash
Closed

Abhinandansinha01 wants to merge 2 commits into
aws:mainfrom
Abhinandansinha01:fix/lambda-layer-hash

Conversation

@Abhinandansinha01

@Abhinandansinha01 Abhinandansinha01 commented Jan 29, 2026 •

Copy link
Copy Markdown

Description

Fixes #36713

When calculateFunctionHash computes the hash for a function, it currently includes the hash of all layers in the stack (fn._layers), regardless of whether they are attached to the function. This causes unnecessary function updates when unrelated layers in the same stack are modified.

This PR modifies the logic to filter fn._layers and only include those that are actually present in the function's CloudFormation properties (properties.Layers).

Validation

  • Manual verification via code review
  • (Pending) Integration tests

@aws-cdk-automation
aws-cdk-automation requested a review from a team January 29, 2026 18:50
@github-actions github-actions Bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p2 labels Jan 29, 2026
Previously, calculateFunctionHash was including all layers from the stack (fn._layers) in the hash calculation, even if they were not attached to the function. This caused unrelated layer changes to trigger function updates. This change filters fn._layers to only include those present in the function's CloudFormation properties.

Signed-off-by: Abhinandan Sinha <[email protected]>

@aws-cdk-automation aws-cdk-automation left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter fails with the following errors:

❌ Fixes must contain a change to an integration test file and the resulting snapshot.

If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.

@aws-cdk-automation

Copy link
Copy Markdown
Collaborator

This PR has been in the CHANGES REQUESTED state for 3 weeks, and looks abandoned. Note that PRs with failing linting check or builds are not reviewed, please ensure your build is passing

To prevent automatic closure:

  • Resume work on the PR
  • OR request an exemption by adding a comment containing 'Exemption Request' with justification e.x "Exemption Request: "
  • OR request clarification by adding a comment containing 'Clarification Request' with a question e.x "Clarification Request: "

This PR will automatically close in 14 days if no action is taken.

@aws-cdk-automation

Copy link
Copy Markdown
Collaborator

This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error.

@aws-cdk-automation aws-cdk-automation added the closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. label Mar 6, 2026
@github-actions

github-actions Bot commented Mar 6, 2026

Copy link
Copy Markdown
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

This branch was previously deployed

1 inactive deployment
automation — 73dadd8e Deployed Apr 25, 2026 by aws-cdk-automation via validate-pr #342173
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. closed-for-staleness This issue was automatically closed because it hadn't received any attention in a while. effort/medium Medium work item – several days of effort p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aws-lambda: calculateLayersHash includes all stack layers instead of only function's layers

2 participants