(aws-lambda-nodejs): Uploaded file must be a non-empty zip
See original GitHub issueWhat is the problem?
I updated lambda function dependancies and deploying the lambda function but it fails with following error.
I also have another api under the same project and I updated its lambda function dependancies and it was deployed successfully.
Both api’s and its lambda functions are almost identical to each other. However only one gets deployed and another one doesn’t.
I deleted the cdk.out
folder and tried to deploy again and it fails with same error each time.
Reproduction Steps
I have simple lambda function that I am trying to deploy as follows
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';
import { Architecture, Code, Function, Runtime } from 'aws-cdk-lib/aws-lambda';
const authFn = new NodejsFunction(this, 'authNodeJs', {
runtime: Runtime.NODEJS_14_X,
entry: `${__dirname}/../auth/index.ts`,
handler: 'auth',
architecture: Architecture.ARM_64,
memorySize: 1024,
environment: {
CLIENT_ID: appClientID
}
})
const auth1Fn = new Function(this, 'authGolang', {
runtime: Runtime.GO_1_X,
code: Code.fromAsset(`${__dirname}/../auth-1/`, {
bundling: {
image: Runtime.GO_1_X.bundlingImage,
user: 'root',
command: [
'bash', '-c', [
'cd /asset-input',
'go build -o main main.go',
'mv /asset-input/main /asset-output/'
].join(' && ')
]
}
}),
handler: 'main',
memorySize: 512,
environment: {
CLIENT_ID: appClientID
}
})
What did you expect to happen?
I expected it to deploy all of my lambda functions.
What actually happened?
It failed with error Uploaded file must be a non-empty zip
CDK CLI Version
2.8.0
Framework Version
No response
Node.js Version
v16.13.2
OS
Ubuntu 20.04 on WSL 2
Language
Typescript
Language Version
~3.9.7
Other information
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:17
- Comments:50 (4 by maintainers)
Top Results From Across the Web
node.js - Uploaded file must be a non-empty zip (Service ...
AWS throws this error - An error occurred: ApiLambdaFunction - Uploaded file must be a non-empty zip (Service: AWSLambdaInternal; Status Code: ...
Read more >Uploaded file must be a non-empty zip - Serverless Framework
This is the serverless.yml that I have created but when I run serverless deploy using nodejs 18.8.0 and serverless 2.19 I get (An...
Read more >[AWS] Solve Error: Uploaded file must be a non-empty zip
First of all, check your lambda function resource path in the template.yaml file, make sure you have the correct path, and it did...
Read more >Terraform not uploading Lambda code zip file to AWS
Use an archive_file, so that when you run “terraform apply”, the file will be automatically re-zipped and uploaded.
Read more >Deploy Python Lambda functions with .zip file archives
If the .zip file is larger than 50 MB, we recommend uploading it to your function from an Amazon Simple Storage Service (Amazon...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I also get this error message when I run
cdk deploy
then cancel it usingCTRL + C
during the bundling stage.When I try to redeploy, it appears to bundle everything again but during the CloudFormation deployment, this error message is shown and fails to deploy.
If I redeploy again, it bundles everything up and then deploys successfully.
It appears as though the second bundling attempt isn’t successful?
Got this error message when upgrading aws-cdk-lib version from 2.31.0 to 2.32.0.