LoginSignup
3
1

More than 1 year has passed since last update.

Lambdaでindex.handler is undefined or not exportedが出た時の対処法

Posted at

問題

Lambda実行時に以下のエラーが発生した

index.handler is undefined or not exported

対処法

以下の2つを実施した。

ファイル名の変更

SAMでサンプルアプリケーションを作成したが、ファイル名がapp.jsとなっていたので以下を変更した。

  • ファイル名変更
    • app.js -> index.js
  • package.jsonの変更
"main": "app.js",

"main": "index.js",

ランタイム設定の見直し

アップロードしたファイル構造と、ランタイム設定が一致していることを確認する。

例えば、以下の構造の場合

|--src
   |--index.js

Lambdaの以下のようにランタイム設定のハンドラ部分をsrc/index.handlerとすれば良い

markdown-linter - Lambda 2022-04-17 08-56-00.png

3
1
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
3
1