Lambda Error Handling with SQS Trigger

  • Hey everyone,

    so I am trying to build a queue (fifo) with a worker lambda. Simple enough and it works. But in case of an error, I want to reliably mark the failed workload as failed in a database (no retries!).

    For some errors, I could just use a try-catch block. But in case of other issues (timeout e.g.), the lambda function just fails. The sqs message is "stuck" in "In-Flight" until visibility timeout is reached. Because the visibility timeout is quite high (lambda itself can run ~10min), the message gets put into the SQSs DLQ very late.

    Lambda Destinations don't work because it is not triggered asynchronously.

    Is there a reliable way to immediately react to a failed lambda execution when triggered by SQS?

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • This was removed by the editor as SPAM

  • Really depends on what you mean here and what language. AWS Lambda's in Python for example use various exception libraries. When an exception is raised, for example, due to a key error or value error, you can essentially have the Lambda record a log that is accessible via AWS CloudWatch. From AWS CloudWatch, you can essentially trigger whatever you like from there due to the details of the log. For example,  you should be able to toss those logs to a queue and trigger additional AWS Lambdas from the messages in that queue.

    AWS Lambda -> Exception -> Log -> SQS -> Reaction

    I would start at the log level data because it's the core of all AWS Lambda functions.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply