AWS Lambda Error: “Cannot find module '/var/task/index'”

后端 未结 9 1700
忘掉有多难
忘掉有多难 2020-12-23 02:54

Node.js Alexa Task Issue

I\'m currently coding a Node.js Alexa Task via AWS Lambda, and I have been trying to code a function that receives informat

相关标签:
9条回答
  • 2020-12-23 03:26

    Update to the accepted answer: When this error occurs, it means your zip file is not in the valid form which AWS requires.

    If you double click on zip you will find your folder inside that your code file,but lambda wants that when you double click on zip it shoud show direct code files.

    To achieve this:

    open terminal  
    cd your-lambda-folder 
    zip -r index.zip *
    

    Then, upload index.zip to AWS Lambda.

    0 讨论(0)
  • 2020-12-23 03:28

    In my case I had to replace

    exports.handler = function eventHandler (event, context) {
    

    with

    exports.handler = function (event, context, callback) {
    
    0 讨论(0)
  • 2020-12-23 03:36

    This is probably a permissions issue with files inside your deployment zip. Try chmod 777 your files before packaging them in a zip file.

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