-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
CDK deploy: using exclusively tag creates incorrect lambda artifacts in nested stack #22834
Comments
SOLVED in my case - seems a bit different I had the same issue with a different scenario: the lamda asset contains the whole cdk folder instead of the lambda code folder. When I run the $ cdk diff <STACK> --exclusively
Bundling asset <STACK>/Handler/Code/Stage...
cdk.out\bundling-temp-1dee8aac52600b32dee4d83c9d5779ad4fa5c468099c86605997d49353d32807\index.js 2.2mb
cdk.out\bundling-temp-1dee8aac52600b32dee4d83c9d5779ad4fa5c468099c86605997d49353d32807\index.js.map 3.3mb
Done in 386ms
Stack <STACK> (<STACK>)
Resources
[~] AWS::Lambda::Function<FUNCTION_NAME>/Handler Handler886CB40B
├─ [~] Code
│ └─ [~] .S3Key:
│ ├─ [-] 6739e30f6cee08ec5950b7cf6077bf601387ec83ca97c857095a92a422a61026.zip
│ └─ [+] 88c7181e5b3e3e4fc4b91c4cf5c329c3d052de45d21e52adb11fc0de93102275.zip
└─ [~] Metadata
└─ [~] .aws:asset:path:
├─ [-] ..\asset.6739e30f6cee08ec5950b7cf6077bf601387ec83ca97c857095a92a422a61026
└─ [+] ..\asset.88c7181e5b3e3e4fc4b91c4cf5c329c3d052de45d21e52adb11fc0de93102275 When I run the $ cdk diff <STACK>
Including dependency stacks:<STACK_DEP1>, <STACK_DEP2>
Stack <STACK_DEP1> (<STACK_DEP1>)
There were no differences
Stack <STACK_DEP2> (<STACK_DEP2>)
There were no differences
Stack<STACK> (<STACK>)
Resources
[~] AWS::Lambda::Function <FUNCTION_NAME>/Handler Handler886CB40B
├─ [~] Code
│ └─ [~] .S3Key:
│ ├─ [-] 6739e30f6cee08ec5950b7cf6077bf601387ec83ca97c857095a92a422a61026.zip
│ └─ [+] 8d233736a3522a3bb4c3bc2c2f70cf637b01500f89560e73e579cbd5ea36e92a.zip
└─ [~] Metadata
└─ [~] .aws:asset:path:
├─ [-] ..\asset.6739e30f6cee08ec5950b7cf6077bf601387ec83ca97c857095a92a422a61026
└─ [+] C:\Users\<CDK_PROJECT_PATH> In the later case, we can notice that I was using:
After upgrading aws-cdk to 2.50.0, the issue is gone. 🕺 🥳
|
Tested on 2.50.0 as well with no luck.
|
I think this is due to #21248. I think the simplest fix might be to update the bundlingRequired function to match on the parent stack if it is a nested stack. Maybe something like: return bundlingStacks.some(pattern => minimatch(
this.nestedStackParent?.node.id ?? this.node.id,
pattern,
}); |
As a temporary workaround you might be able to do:
|
This issue is now over a year old and has no resolution? |
Describe the bug
creating a lambda in a nested stack (if it is not in the nested stack, it works fine) and deploying using
--exclusively
, the lambda artifact created is incorrect and contains the whole cdk folder. running onlycdk deploy
works fine.Expected Behavior
cdk deploy
andcdk deploy --exclusively stateless-stack-*
should both work and be identical in the stack they createCurrent Behavior
cdk deploy
workscdk deploy --exclusively stateless-stack-*
does not work. The s3 artifact it tries to create contains the full cdk folder (which in my case is greater than 250 mb) and so it fails with the errorUnzipped size must be smaller than 262144000 bytes
Reproduction Steps
this is the a sample reproduction file I created
The content of the lambda file are irrelevant for this test case but it is
Possible Solution
exclusively
tagAdditional Information/Context
package.json
CDK CLI Version
2.50.0
Framework Version
No response
Node.js Version
14
OS
Linux
Language
Typescript
Language Version
14.19.0
Other information
AWS support Case ID 11227109211
The text was updated successfully, but these errors were encountered: