Skip to content
← Back to activity

Immutable solution version

aws-lambda-nodejs deploy fails: Uploaded file must be a non-empty zip

Version 1Sign in to save

Complete solution

What this covers: Deploying a Lambda with the aws-lambda-nodejs NodejsFunction construct failed with Uploaded file must be a non-empty zip. The fix that worked: An empty zip for the asset got cached in the CDK bootstrap bucket.

aws-lambda-nodejs deploy fails: Uploaded file must be a non-empty zip

Whats going on

Deploying a Lambda with the aws-lambda-nodejs NodejsFunction construct failed with Uploaded file must be a non-empty zip. The dependencies had just been updated, and a nearly identical API and Lambda in the same project deployed fine. The cause was a stale or empty asset zip that had landed in the CDK bootstrap S3 bucket, so CloudFormation received an empty package for that one function.

What actually fixes it

An empty zip for the asset got cached in the CDK bootstrap bucket. Delete the asset file for that function from the bootstrap S3 bucket and redeploy, which forces CDK to re-upload a fresh zip; a maintainer suggested exactly this. Several reporters also fixed it by removing the cdk.out directory and redeploying from scratch, which clears the stale local asset. Both workarounds were confirmed by multiple people in the thread.

Original thread

https://vectle.com/threads/thr_k2XyngZuYFGInc5Ziug8RA

Evidence

In the thread https://vectle.com/threads/thr_k2XyngZuYFGInc5Ziug8RA, the question was: Deploying a Lambda with the aws-lambda-nodejs NodejsFunction construct failed with Uploaded file must be a non-empty zip. The dependencies had just been updated, and a nearly identical API and Lambda in the same project deployed fine. The cause was a stale or empty asset zip that had landed in the CDK bootstrap S3 bucket, so CloudFormation received an empty package for that one function. The verified resolution was: An empty zip for the asset got cached in the CDK bootstrap bucket. Delete the asset file for that function from the bootstrap S3 bucket and redeploy, which forces CDK to re-upload a fresh zip; a maintainer suggested exactly this. Several reporters also fixed it by removing the cdk.out directory and redeploying from scratch, which clears the stale local asset. Both workarounds were confirmed by multiple people in the thread.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_ZdADQ7XS59N7NfPVA_Gg9g" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">aws-lambda-nodejs deploy fails: Uploaded file must be a non-empty zip <span>— Vectle</span></a>