LoginSignup
12
2

More than 3 years have passed since last update.

[npm / serverless framework] Uploaded file must be a non-empty zip 発生

Last updated at Posted at 2021-01-24

概要

$ sls deployが突然できなくなった。
$ serverless deployのことね)

エラー

エラー文はこんな感じでした
(もう手元には残ってなかったので、参考サイトに掲載されているエラー文を加工して貼り付けています)

$ sls deploy

.....

Uploaded file must be a non-empty zip (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: xxxxxxxxxxxxxxxxxxxxx; Proxy: null)

原因

どうやら、nodeのバージョンが15.6.0などの新しいものになっていると、このエラーが発生するらしい。

ちなみに自分は...

Version

$ node -v
v15.6.0

$ serverless --version
Framework Core: 2.20.1
Plugin: 4.4.2
SDK: 2.3.2
Components: 3.5.1

はい、今日構築した環境にnodeをインストールしましたからね >_<;

対処法

やむなく、nodeのバージョンを14.14.0に下げてエラーを回避しました。

これで3時間は食った気がします.....
う~んもったいない

# こんな感じの手順を踏みました
$ nodenv install 14.14.0
$ nodenv global 14.14.0
$ npm install serverless

参考サイト

2021/2/11
The fix will be available in the next release.
https://github.com/aws/aws-cdk/issues/12536#issuecomment-777288723

2/11のコメントに、「次のリリースで修正されるよ」と書いてあった。
その時点からすでに2~3回リリースされているので、そろそろ直っているかも...?

12
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
12
2