-
Notifications
You must be signed in to change notification settings - Fork 4.1k
custom_resources: AwsCustomResource deployment fails with "Uploaded file must be a non-empty zip" error #34176
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
Comments
Hey @jscott-resilient, thank you for reaching out. On diving into the issue and working on reproducing the issue using the code provided, here's what i have tried Reproductions steps:
Could let us know if the reproduction steps used does align with your project setup and the steps used? |
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. |
Ah sorry for missing the reply, easter celebrations got in the way! Thanks for looking into this, so it does look like you have reproduced it exactly. The only difference on our side is that the region parameter passed into CrossRegionParameterReader is us-east-1 and the region parameter for the app is eu-west-2. So when deploying here are the logs that cdk produces under version 2.165.0
and then the logs for 2.166.0
No other changes have been made to the code, is there something I could look for on my end which could be a likely candidate to cause this error? |
@jscott-resilient thank you for the information. Retried the reproduction with different region as suggested but i was able not able to reproduce the issue. But noticed similar issues previously opened #18459 and #32869. it does appear a fix was released in the newer versions of AWS CDK #33201. Could you try upgrading to latest or atleast Do let me us know if this does not fix the issue. |
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. |
Hi @ykethan, Thanks for looking into this! So I tried version 2.192.0 and still no luck (even with removing cdk.out and running synth). I ran synth and retrieved the zip file from the assets s3 bucket using version 2.165.0 and 2.192.0. For 2.165.0 the zip file successfully unzipped and contained a index.js and a entrypoint.js file. But doing the same for 2.192.0 I get the following error when trying to unzip the file ![]() so it looks like the error in the logs is correct! I have tried deleting the asset from s3 bucket but still the same Do you have any more suggestions? |
Hey @jscott-resilient, interesting. With the latest versions of CDK packages installed could you try running the deploy command with cdk deploy --force |
Thanks for the detailed report. To help diagnose why your specific deployment fails with v2.166.0+, could you please provide details about the environment for your
|
Hi @ykethan, Gave it a try, unfortunately the same result :( This is the deploy command that was run with the latest version (at the time 2.192.0)
and the output
and thanks for joining the fight @pahud! I Really appreciate it! The lambda function is not configured to run within a VPC and within the |
Hi, this is interesting and weird. Are you able to create a new repo with minimal cdk code required for repro or just make it a zip and attach to this issue so we can clone/download and try deploy in our environment? We need to make sure we use the same codebase. If yes, please make sure only include general required code, don't include business-related code. Thank you. |
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. |
So I've created a separate repo to test this in and I'm no longer getting the error (which isn't very helpful), but I have noticed something in the logs. In the new demo repo the lambda function is referred to by a generated id AWS679f53fac002430cb0da5b7982bd2287 (version 2.194.0)
but in the original project using version 2.165.0 the logs refer to the lambda function as cf/Custom::CrossRegionStringParameterReaderCustomResourceProvider/Handler
and in the same project (using 2.192.0) the logs refer to two lambda functions cf/Custom::CrossRegionStringParameterReaderCustomResourceProvider/Handler and AWS679f53fac002430cb0da5b7982bd2287, could that be a potential issue?
The next step I can do in dev is tear down the stack and rebuild it from scratch to see if it would work, but this will be impossible to do in prod so is there anything else I could try? Thanks again for helping out, Joe |
Hey @jscott-resilient , thank you for getting back to us on this. while this may be the unlikely, could you try running the following to verify the versions used?
Then try removing the this is to rule out if the packages may be the reason for this behavior and verify by rebuilding and deploying the assets. |
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. |
Describe the bug
My project is currently on version 2.165.0 and upgrading to anything higher (I've tried 2.166.0) causes the following error to occur:
cf/Custom::CrossRegionStringParameterReaderCustomResourceProvider/Handler (CustomCrossRegionStringParameterReaderCustomResourceProviderHandler65B5F33A) Resource handler returned message: "Uploaded file must be a non-empty zip (Service: Lambda, Status Code: 400, Request ID: 7a077b2b-1336-4280-b3c1-198d2fbc08c2) (SDK Attempt Count: 1)
The construct code is as follows:
Thanks for looking into this! If you need anymore information please let me know!
Regression Issue
Last Known Working CDK Version
2.165
Expected Behavior
The zipped lambda code within the cdk bootstrap s3 bucket is formatted correctly to allow deployment
Current Behavior
The zipped lambda code is defined within the bootstrap s3 bucket but causes the "Uploaded file must be a non-empty zip", it is a non empty zip file so the issue causing this error is unknown
Reproduction Steps
Upgrading aws-cdk-lib version higher than 2.165
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.1010.0 (build 6b421db)
Framework Version
No response
Node.js Version
v20.13.1
OS
macOS Sequoia Version 15.4
Language
TypeScript
Language Version
Typescript (5.8.3)
Other information
No response
The text was updated successfully, but these errors were encountered: