Struggle between NodeJS version 14 and 15 for AWS Lambda serverless Project

My node version is 16, however when I start to create a AWS project and when deploy it, an error appears .

An error occurred: HelloLambdaFunction - Resource handler returned message: "Uploaded file must be a non-empty zip ) 

The solution is downgrading my node version to 14 ( I search on the internet ), but only node version higher than 15 can support ??= operator in my another project. Now I am so confused.

Please teach me how to solve this, thank for your attention.

Upvotes: 0

Views: 2843

Answers (1)

Jens
Jens

Reputation: 21500

I think several things are getting mixed up here.

First of all the default AWS Lambda NodeJS runtime only supports NodeJS v14, not v16. Read the official runtime documentation for more information. You could however build a Docker image where you use NodeJS 16.x, but this is a different topic all together.

Second, you get the following error:

Uploaded file must be a non-empty zip

This indicates that the issue is not really the NodeJS version, but that for some reason you have been uploading an empty ZIP archive. So maybe check that out first.

Upvotes: 6

Related Questions