-
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
DefaultStackSynthesizer: Using a StackSynthesizer and Sharing Assets will only Publish One Asset and Not the Other #25927
Comments
Thank you. Are you able to provide a minimal code sample that I can copy/paste to reproduce this bug? |
Bin File:
Lib File:
Stack 2:
Index Handler:
|
If you run |
Thanks for the report! |
If the same asset is used in 2 stacks that use different synthesizer configurations for publishing (for example, by using a different prefix) the asset will only be uploaded once instead of twice. We used to make the assumption that it was okay to use the destination ID as token of uniqueness. This is true inside a single manifest, but does not hold when there is more than stack that each have a manifest: both may have the destination ID `current_account:current_region`, but have different parameters for each destination. Instead, we calculate a content hash over the destination definition itself. That way, if the definitions are different we will create different nodes for each of them. Fixes #25927.
If the same asset is used in 2 stacks that use different synthesizer configurations for publishing (for example, by using a different prefix) the asset will only be uploaded once instead of twice. We used to make the assumption that it was okay to use the destination ID as token of uniqueness. This is true inside a single manifest, but does not hold when there is more than stack that each have a manifest: both may have the destination ID `current_account:current_region`, but have different parameters for each destination. Instead, we calculate a content hash over the destination definition itself. That way, if the definitions are different we will create different nodes for each of them. Fixes #25927. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Describe the bug
If a Synthesizer is used and the an Asset is shared between two Stacks on the same App, one of the Stacks will have a published asset to reference while the other Stack will not.
Expected Behavior
If a Synthesizer is used and the prefixes are different, the Assets should be able accessible to both Stacks.
Current Behavior
One Stack will be able to access the asset, while the other will return a
Resource handler returned message: "Error occurred while GetObject. S3 Error Code: NoSuchKey. S3 Error Message: The specified key does not exist.
due to a missing asset.Reproduction Steps
bin
orapp.py
file that creates two stacksDefaultStackSynthesizer
Lambda Function
resource with alogRetention
propPossible Solution
Since this is unique to version 2.8X.X, the Asset removal might need to be reviewed
Additional Information/Context
No response
CDK CLI Version
2.81.0
Framework Version
No response
Node.js Version
18.16.0
OS
macOS 12.6.6
Language
Typescript, Python, .NET, Java, Go
Language Version
5.0.4
Other information
No response
The text was updated successfully, but these errors were encountered: