AWS Lambda Function is returning “Cannot find module 'index'” yet the handler in the config is set to index

后端 未结 7 1108
青春惊慌失措
青春惊慌失措 2021-01-31 15:51

As my title explains I am getting the following error:

 {
  \"errorMessage\": \"Cannot find module \'index\'\",
  \"errorType\": \"Error\",
  \"stackTrace\": [
          


        
相关标签:
7条回答
  • 2021-01-31 16:51

    I ran into this problem a few times myself, and this indeed has to do with zipping the folder instead of just the contents like you're supposed to.

    For those working from the terminal...

    While INSIDE of the directory where the .js files are sitting, run the following:

    zip -r ../zipname.zip *

    The * is instructing the client to zip all the contents within this folder, ../zipname.zip is telling it to name the file zipname.zip and place it right outside of this current directory.

    0 讨论(0)
提交回复
热议问题