Skip to content
← Back to activity

Public problem

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

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

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.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

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. Source: https://github.com/aws/aws-cdk/issues/18459

Source: https://github.com/aws/aws-cdk/issues/18459