-
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
aws-lambda-nodejs: Not working with NestedStack #23181
Comments
I wasn't able to reproduce this, I can deploy the exact same NodejsFunction both inside a nested stack and outside. What is the specific error message you're getting? |
Thank you @peterwoodworth for answering. I wrote the code in this repo https://github.com/Depaa/aws-sdk-nodejs-nested-function after the deploy this is how the lambda package turn out: I do have a work around which creates another stack, but I do not like it because I had to create a new deploy for each main resource. |
Thanks for sharing you repo @Depaa, I cloned it and am still unable to reproduce the behavior you describe. Just to make sure Im not missing anything, where exactly are you finding that the lambda package looks like that? Also, is this happening in prod, non prod, or both? |
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled. |
@peterwoodworth I believe that screenshot will be the function code artefact, so when you export the lambda function from the AWS console, inside the zip is what is in that screenshot, his entire project.. rather than the single js bundle from esbuild I'm having the same issue, but worse in that I can't even get it to deploy because my project as a whole is too large. It simply fails to deploy because the ZIP file is 1GB I use NodejsFunction heavily across other stacks, as soon as it moves into a nested stack it starts packaging the entire project and from what I can tell, it doesn't even run I haven't gotten to the stage of workaround yet, I am still hopeful to find the root cause here.. but worst case I will do what @Depaa mentioned (deploy as separate stacks, not ideal) or I might just take over bundling myself and drop usage of |
Just done some more digging and have identified a difference internally within CDK here
I shall keep digging 🙃 |
Looks like this issue is related (or the same) to this one #12898 |
Describe the bug
When creating lambdas with aws-lambda-nodejs in a NestedStack it takes the wrong entry point to the lambda function. I think it takes the root folder only when deploying.
Expected Behavior
It deploys the lambdas following the right entry point specified
Current Behavior
It deploys the lambdas using the root folder as entry point, it breaks every lambda within the nested stack
Reproduction Steps
api gateway stack
posts api nested stack
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.42.1 (build 48a95f1)
Framework Version
No response
Node.js Version
v16.17.0
OS
Windows
Language
Typescript
Language Version
Typescript (4.9.3)
Other information
No response
The text was updated successfully, but these errors were encountered: