AWS Lambda function timing out

后端 未结 2 1521
夕颜
夕颜 2021-01-21 04:13

In my local mocha tests the following handler function works just fine. However, when I upload to AWS (using Serverless framework) it times out (unless you don\'t provide a

相关标签:
2条回答
  • 2021-01-21 04:46

    Add the following as the first line of your handler function:

    context.callbackWaitsForEmptyEventLoop = false
    
    0 讨论(0)
  • 2021-01-21 04:51

    I guess that you're using lambda with "Node.js Runtime 0.10"

    So you should add

    context.done(null, 'Terminate Lambda');
    

    to terminate the execution.

    As the AWS lambda document, it mentions that:

    The callback is supported only in the Node.js runtime v4.3. If you are using the earlier runtime v0.10.42, you need to use the context methods (done, succeed, and fail) to properly terminate the Lambda function.

    Please refer this link for above information

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