Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Aws lambda retry behavior when triggered by cloudwatch event

I have created a lambda function which is triggered through cloudwatch event cron. While testing I found that lambda retry is not working in case of timeout. I want to understand what is the expected behaviour.Should retry happen in case of timeout?

P.S I have gone through the document on the aws site but still can't figure out https://docs.aws.amazon.com/lambda/latest/dg/retries-on-errors.html

like image 387
RSingh Avatar asked Feb 09 '18 14:02

RSingh


2 Answers

Found the aws documentation on this,

"Error handling for a given event source depends on how Lambda is invoked. Amazon CloudWatch Events is configured to invoke a Lambda function asynchronously."

"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."

So the retry should happen in this case. Not sure what was wrong with my lambda function , I just deleted and created again and retry worked this time.

like image 160
RSingh Avatar answered Sep 28 '22 03:09

RSingh


Judging from the docs you linked to it seems that the lambda function is called again if it has timed out and the timeout is because it is waiting for another resource (i.e. is blocked by network):

The function times out while trying to reach an endpoint.

As a cron event is not stream based (if it is synchronous or asynchronous seems not be be clear from the docs) it will be retried.

like image 20
hansaplast Avatar answered Sep 28 '22 05:09

hansaplast