Briswell Tech Blog

ブリスウェルのテックブログです

Elastic Beanstalk のエラー

暑い日々が続いておりますね。
みなさま、いかがお過ごしでしょうか。

今回はElastic Beanstalk(以下EBと記載します) のサポート対象から Node.js 12 が消滅するので、16にあげる作業を行った際に、よくわからないエラーにぶち当たったので、備忘録含め、記載します。


Node.js 12 running on 64bit Amazon Linux 2 から
Node.js 16 running on 64bit Amazon Linux 2 にアップデートを行おうと、少し調整を入れ、Circle CIからEBへデプロイをかけたところ、

CIエラー

ERROR: TimeoutError - The EB CLI timed out after 10 minute(s). The operation might still be running. To keep viewing events, run 'eb events -f'. To set timeout duration, use '--timeout MINUTES'.

タイプアウトでデプロイが失敗しました。
ログを出力してみると何も出ていない...

よくわからないので、ダメ元で再度CIを実行しました。

CIエラー2

2022-08-22 04:12:40 ERROR Instance deployment: 'npm' failed to install dependencies that you defined in 'package.json'. For details, see 'eb-engine.log'. The deployment failed.
2022-08-22 04:12:40 ERROR Instance deployment failed. For details, see 'eb-engine.log'.
2022-08-22 04:12:41 ERROR [Instance: i-0b7da73e780dfead2] Command failed on instance. Return code: 1 Output: Engine execution has encountered an error..
2022-08-22 04:12:41 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2022-08-22 04:12:41 ERROR Unsuccessful command execution on instance id(s) 'i-0b7da73e780dfead2'. Aborting the operation.
2022-08-22 04:12:41 ERROR Failed to deploy application.



今度はエラーが出ていたので、詳細確認のため、ログを見てみると

2022/08/22 04:12:40.550548 [ERROR] An error occurred during execution of command [app-deploy] - [Use NPM to install dependencies]. Stop running the command. Error: Command /bin/sh -c npm --production install failed with error signal: killed. Stderr:npm WARN config production Use --omit=dev instead.

2022/08/22 04:12:40.550567 [INFO] Executing cleanup logic

2022/08/22 04:12:40.615852 [INFO] CommandService Response: {"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"Engine execution has encountered an error.","returncode":1,"events":[{"msg":"Instance deployment: 'npm' failed to install dependencies that you defined in 'package.json'. For details, see 'eb-engine.log'. The deployment failed.","timestamp":1661141560538,"severity":"ERROR"},{"msg":"Instance deployment failed. For details, see 'eb-engine.log'.","timestamp":1661141560558,"severity":"ERROR"}]}]}



このようなログが吐き出されていました。
Local で
npm --production install

を実行してもエラーは起こりませんでした。

少しGoogle先生に質問をしたところ、

stackoverflow.com

この記載を見つけました。
インスタンスのスペックが低すぎるのが原因ではないか。
確かに上記エラーが発生したEBのスペックは t3.micro でした。

藁にも縋る気持ちで、t3.medium に更新を行い、再度チャレンジしました...

結果は成功。


ログだけ見てもよくわからない系のエラーは悩ましいですね。解決できてよかったです。