aws-lambda Cannot find module

前端 未结 12 716
野性不改
野性不改 2020-12-06 04:20

I keep getting this error in the aws-lambda console when uploading code from a zip file. I have tried uploading other zip files and they work correctly. The .js file is name

12条回答
  •  旧巷少年郎
    2020-12-06 05:00

    The way I was able to get this to work was:

    1. Name the file exports.js
    2. Name the handler, within the file, exports.handler
    3. Set the handler in the lambda config to exports.handler
    4. Zip up only the contents of the folder, not the folder itself (as mentioned above) and rename the zip file exports.zip

提交回复
热议问题