serverless: Mac: aws-go-mod deploy failed Uploaded file must be a non-empty zip
On my local Mac, I was trying the aws-go-mod template and sls deploy failed with
An error occurred: HelloLambdaFunction - Uploaded file must be a non-empty zip (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: a9d772b9-c1d9-4e74-a6ab-6be5af6feb5e; Proxy: null).
serverless.yml
I did not make any change to serverless.yml out of the template.
⚠️⚠️ REPLACE WITH FULL COMMAND NAME output
> serverless config credentials --provider provider --key key --secret secret
> sls create --template aws-go-mod --path myservice
> cd myservice
> make build
> make deploy
Serverless Error ---------------------------------------
An error occurred: HelloLambdaFunction - Uploaded file must be a non-empty zip (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 5125656a-c0d3-446d-badd-bca2f7063331; Proxy: null).
Installed version
╰─➤ sls --version
Framework Core: 2.19.0
Plugin: 4.4.2
SDK: 2.3.2
Components: 3.4.7
I also tried with sls package first then sls deploy --package, also same issue.
╰─➤ sls package --package ~/Downloads/test
Serverless: Packaging service...
Serverless: Excluding development dependencies...
╰─➤ ls -ltrh ~/Downloads/test 1 ↵
total 12512
-rw-r--r-- 1 ifanchu staff 2.0K Jan 15 23:57 cloudformation-template-create-stack.json
-rw-r--r-- 1 ifanchu staff 11K Jan 15 23:57 cloudformation-template-update-stack.json
-rw-r--r-- 1 ifanchu staff 6.1M Jan 15 23:57 myservice.zip
-rw-r--r-- 1 ifanchu staff 19K Jan 15 23:57 serverless-state.json
╰─➤ sls deploy --package ~/Downloads/test
Serverless Error ---------------------------------------
An error occurred: WorldLambdaFunction - Uploaded file must be a non-empty zip (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 2f191f1a-2582-4d7d-8c85-1705f2384778; Proxy: null).
Am I doing anything wrong with the template?
AWS Setting
╰─➤ cat ~/.aws/config
[default]
region = us-west-2
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 19
- Comments: 30 (9 by maintainers)
Links to this issue
Commits related to this issue
- :wrench: downgrade travis node version See: https://github.com/serverless/serverless/issues/8772 — committed to brokalys/sls-pinger by MatissJanis 3 years ago
- Pin to node 14 Workaround for https://github.com/serverless/serverless/issues/8772 — committed to lucydavinhart/api.lmhd.me by lucymhdavies 3 years ago
- Downgrade Node version to 14 for deploy job Node 15.6.0+ has a bug that causes serverless to produce a zipped package with empty files. Deployment succeeds but the Lambda function fails because handl... — committed to rstudio/r-builds by glin 3 years ago
- revert to node 14 for now https://github.com/serverless/serverless/issues/8772 — committed to hkssprangers/hkssprangers by andyli 2 years ago
Thanks everyone for checking out and confirming that it’s in fact related to node
v15.6.0. I’ve managed to pinpoint the issue to the library that we’re using to create zip archives - https://github.com/archiverjs/node-archiver/issues/491. I’ll be tracking the issue and make sure to let everyone here know as soon as we have a resolution. 💯I was on
v15.6.0I downgraded to
And it is working good now.
Hello everyone - thanks a lot for reporting more details about the issue. I’ve had a hard time reproducing it, but seeing output from @lxwang42 I’ve noticed use of the latest version of node
v15.6.0and in fact, I was able to reproduce the issue on both framework versionsv2.18.0andv2.19.0. Surprisingly, when going back to nodev14or even tov15.5.0, the problem does not exist (or at least I wasn’t able to reproduce). It seems like the packagedzips are broken as when even trying to unzip them locally they error out withbad CRCas was also shown by @ifanchu.The question to everyone reporting - are you all on node
v15.6.0or is there anyone that experiences the same issue with different node versions? I triedv10,v12,v14,v15.5.0and could not reproduce. For now, I’ll continue the investigation under the assumption that issue is present only on thev15.6.0of node.Thanks everyone for detailed reports 🙇
node v16 - same issue… fixed by overriding
crc32-streamversion by:in
package.jsonI can also confirm I was running Node v15.6.0 and when I rolled back to Node v14.15.1 all is working fine so it seems to be Node related
To let everyone know, it has been confirmed to be a Node issue: https://github.com/nodejs/node/issues/37027
I’ve had to roll back as well from v15.6.0 and v14.15.1 worked.
I’ve tested with Node 15.5 and it is working. It seams to be broken only on 15.6.
Hello everyone 👋 The original issue has been resolved and new version of
crc32-streamhas been published. All newserverlessinstallations should use that version by default. I’m closing this issue, but if you’re still running into errors please let us know 🙇Confirmed working with node@14
I created a small reproducer repository. See the Github action and the latest output.
i’m having the same issue, tested on fresh osx and debian 10 with nodejs helloworld example. got the same error
I’m having the exact same issue today with code that was working perfectly before. I’m working with serverless 2.19.0 but I’ve also downgraded to 2.18.0
I’m testing with a Python lambda function, even a simple hello world function won’t deploy with the following error
Uploaded file must be a non-empty zip (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException;
Confirmed rolling back from node @ 15.6.0 to 14.15.4 fixed the problem for me.