You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great to have two different stacks, one for the lambda layer version and one for the lambda function. Changes to lambda layer version in the other stack should automatically trigger an update to the function referencing it that is in another stack.
SSM Parameter is used as a workaround for this use case but when the lambda layer version is updated, the lambda function does not automatically update, it has to be updated manually to reflect the changes in the lambda layer version. Without the SSM parameter, the error Export [name] cannot be updated as it is in use by stack since we cannot update the exports and imports which are in use by other stack is returned.
Proposed Solution
No response
Other Information
No response
Acknowledgements
I may be able to implement this feature request
This feature might incur a breaking change
CDK version used
2.118.0
Environment details (OS name and version, etc.)
MacOS, language=TypeScript
The text was updated successfully, but these errors were encountered:
Thanks for the feature request. For more background here is the PR which introduced the changes in 2.27.0, which are referenced in the documentation that you linked.
I am experiencing this issue as well. To clarify the behavior I observe:
The currentVersion hash is calculated during the synth phase, based on the code and configuration of the Lambda function.
This hash calculation appears to rely on either:
The hardcoded ARN of a Lambda Layer, or
A hardcoded reference to an SSM parameter containing the ARN of the Lambda Layer.
Since the SSM reference itself does not change when the value of the SSM parameter is updated, the hash remains unchanged. As a result, the currentVersion does not update when the Lambda Layer ARN changes in the SSM parameter.
To address this, the hash for currentVersion needs to be determined at deploy time, based on the actual value of the SSM parameter at that moment, rather than the reference to the SSM parameter.
Additionally, it would be beneficial to have a native way to reference the $LATEST version of a Lambda Layer, avoiding the need for the SSM parameter workaround. However, I recognize that even this approach would not resolve the core issue. The currentVersion hash must incorporate the resolved Lambda Layer ARN, which might only be available at deploy time."
Describe the feature
Currently, the @aws-cdk/aws-lambda:recognizeLayerVersion feature flag only works if the lambda layer version and lambda function are in same stack.
https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_lambda-readme.html#currentversion-updated-hashing-logic-for-layer-versions
Use Case
It would be great to have two different stacks, one for the lambda layer version and one for the lambda function. Changes to lambda layer version in the other stack should automatically trigger an update to the function referencing it that is in another stack.
SSM Parameter is used as a workaround for this use case but when the lambda layer version is updated, the lambda function does not automatically update, it has to be updated manually to reflect the changes in the lambda layer version. Without the SSM parameter, the error
Export [name] cannot be updated as it is in use by stack since we cannot update the exports and imports which are in use by other stack
is returned.Proposed Solution
No response
Other Information
No response
Acknowledgements
CDK version used
2.118.0
Environment details (OS name and version, etc.)
MacOS, language=TypeScript
The text was updated successfully, but these errors were encountered: