(core/aws-lambda-nodejs/cli): confusing NodejsFunction+Stage+exclusive-cli-flag behaviour
See original GitHub issueWhen deploying using all of the following, the asset for the Lambda function is a zip of the root of the project, not the asset as expected:
- a stack containing a
@aws-cdk/aws-lambda-nodejs.NodejsFunction
Lambda function - attaching the stack I’m deploying to a
@aws-cdk/core.Stage
rather than to a@aws-cdk/core.App
- using the
-e
(exclusive) flag to the synth or deploy commands
Based on my testing, not doing any one of these things results in the expected behaviour where the asset is the expected thing.
See dummy project here https://github.com/isotoma/cdk-nodejsfunction-asset-size-debugging to show my testing and why I have ended up where I have.
I happened to find this because a real project uploaded the whole project root as the source asset for the Lambda, which ended up being over Lambda’s 250MB limit.
Reproduction Steps
See https://github.com/isotoma/cdk-nodejsfunction-asset-size-debugging, and the branches listed in the readme, and the behaviour shown in the Github CI.
What did you expect to happen?
- Use of the
-e
CLI flag should not affect the built asset - Use of a
Stage
should not affect the built asset
What actually happened?
- I would not expect the whole project directory to ever be zipped and uploaded to the assets bucket.
Environment
- CDK CLI Version : 1.110.1 (also affects >= 1.102.0, because that’s where the feature to deploy stacks from stages arrived, see https://github.com/aws/aws-cdk/pull/14379. Believe earlier versions did not have this feature.)
- Framework Version: 1.110.1
- Node.js Version: v14.17.0
- OS: Linux
- Language (Version): Typescript 4
Other
I am mildly suspicious of switches in context
in cdk.json
, but for no real reason, and have no guesses as to what might actually be wrong.
Happy to try other things with my dummy project if useful.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:5 (2 by maintainers)
Top GitHub Comments
Thanks for the detailed investigation! Unfortunately we ourselves might not be able to get to this quickly, as there are many issues competing for our attention. I hope @jogold has some spare cycles to investigate, otherwise please collect upvotes on this issue to raise the priority.
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.