-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[lambda] Function.currentVersion only updates for framework assets #10136
Comments
Can you provide an example? |
Yes, but not publicly. |
Why not just use environment variables as a way to include additional info in the hash? |
That is what we have been doing to work around this. It's not elegant, but it's functional. |
We can add some "formal" way to salt the version if that feels better. What do you think? |
Is it an idea to use |
Sorry to necro the thread -- yes I think that would be a reasonable approach. Having something in the documentation that mentions this workaround would also be helpful |
This is created to provide an example of a workaround for #10136 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This is created to provide an example of a workaround for aws#10136 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
This code seems to assume that the Function's CloudFormation representation is good enough to determine the full source hash, which is not true as soon as indirection through a { Ref } or something comes into play:
https://github.com/aws/aws-cdk/blob/master/packages/@aws-cdk/aws-lambda/lib/function-hash.ts
The Code class needs a way to mix in another value in there, so that if the Code comes from an asset, even if that asset is referenced through { Ref }s or whatever, it still has an opportunity to mix in a sourceHash of some sort to cause the Version to be updated.
It works for new-style assets because the asset
sourceHash
has been hardcoded into the CFN template fragment.It works for old-style assets because the asset
sourceHash
has been hardcoded into the parameter name (so the template fragment looks like{ Ref: AssetObjectKey035fcdc6941252eb150bf31facc9dc4e }
.It does not work for custom assets (such as the ones used to integrate with Amazon's internal build system) which reference parameters that look like
{ Ref: SomeNameThatsTheSameEveryTime }
.The correct solution is to explicitly work the
asset.sourceHash
into the content hash somewhere, and not rely on the CloudFormation template fragment alone.This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: