Home > Software engineering >  Retry mechanism of aws lambda is not working. It is not retrying after timeout exception
Retry mechanism of aws lambda is not working. It is not retrying after timeout exception

Time:05-26

I am using a small piece of code to intentionally timeout lambda function

import json
import time
def lambda_handler(event, context):
    time.sleep(5)

These are my lambda configuration -

general configuration

Asynchronous invocation

The error I am getting after running this script -

Error logs

But it is not retrying after timeout exception.

CodePudding user response:

Your problem seems to be that your SNS message has expired before the first retry can happen. Lambda retries happen at 1 minute and then a further 2 minutes later. Your configuration expires asynchronous events after 1 minute.

When using the default settings (6h max age, 2 retry attempts, no DLQ), your code works correctly and retries twice before failure.

  • Related