LoginSignup
0
0

AWS – Terraformで作成した Lambda関数で実行時エラー ( lambda_handler is undefined or not exported ) ( node.js )

Posted at

エラー

Lambda実行時にこんなエラーが起こる (node.js)

index.lambda_handler is undefined or not exported

スクリプトは

export const handler = async(event) => {
   // ...
}

解決

  • ファイル名を index.js / index.mjs にする
  • 関数名を lambda_handler にする

で解決した

export const lambda_handler = async(event) => {
   // ...
}

ファイル名と関数名を揃える必要があるみたいだ

Terraform

Terraformではhandlerをこのように指定していた

resource "aws_lambda_function" "xxx" {
  handler          = "index.lambda_handler"
}

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

0
0
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
0
0