简体   繁体   English

AWS Lambda任务超时

[英]AWS Lambda Task timed out

I have create a one function and sent mail to users but it time out 我已经创建了一个函数并将邮件发送给用户,但是超时

05:48:54
END RequestId: 3508fc6c-29cb-442b-95dd-c963018ca5f3

05:48:54
REPORT RequestId: 3508fc6c-29cb-442b-95dd-c963018ca5f3  Duration: 900083.68 ms  Billed Duration: 900000 ms Memory Size: 256 MB  Max Memory Used: 43 MB

05:48:54
2019-06-25T05:48:54.532Z 3508fc6c-29cb-442b-95dd-c963018ca5f3 Task timed out after 900.08 seconds

I have set TimeoutInfo 15 min. 我已将TimeoutInfo设置为15分钟。

Another potential issue might be that you have an active connection, so the aws lambda is not responding until the connection terminates. 另一个潜在的问题可能是您有活动的连接,因此aws lambda在连接终止之前没有响应。

callbackWaitsForEmptyEventLoop – Set to false to send the response right away when the callback executes, instead of waiting for the Node.js event loop to be empty. callbackWaitsForEmptyEventLoop –设置为false可以在执行回调时立即发送响应,而不是等待Node.js事件循环为空。 If this is false, any outstanding events continue to run during the next invocation. 如果为假,则所有未完成的事件在下一次调用期间将继续运行。

If this is the case, you can set callbackWaitsForEmptyEventLoop = false to make callback response immediately by 在这种情况下,您可以设置callbackWaitsForEmptyEventLoop = false以立即通过以下方式做出回调响应

context.callbackWaitsForEmptyEventLoop = false;

Official doc 官方文件

Check what is the timeout set in configuration file Also check for VPC! 检查配置文件中设置的超时时间也检查VPC!

"Error handling for a given event source depends on how Lambda is invoked. Amazon CloudWatch Events is configured to invoke a Lambda function asynchronously." “给定事件源的错误处理取决于Lambda的调用方式。AmazonCloudWatch Events配置为异步调用Lambda函数。”

"Asynchronous invocation – Asynchronous events are queued before being used to invoke the Lambda function. If AWS Lambda is unable to fully process the event, it will automatically retry the invocation twice, with delays between retries." “异步调用–异步事件在用于调用Lambda函数之前已排队。如果AWS Lambda无法完全处理该事件,它将自动重试两次该调用,两次重试之间会有延迟。”

So the retry should happen in this case. 因此,在这种情况下应重试。 Not sure what was wrong with your lambda function , just delete and created again and may works! 不知道您的lambda函数出了什么问题,只需删除并重新创建就可以了!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM