Lambda triggered by SQS queue : How to manage errors correctly

0

We are building a conversation engine that could sometimes encounter rate limit when calling an external API. We are currently struggling with the fact that AWS reduce the concurrent run of our lambdas connected to our SQS queues when theses lambdas are failing, because when we encounter a rate limit error, we throw the error for the lambda to fail and wait for the retrying process of the SQS queue.

We searched a way to release gracefully messages in the queue without triggering an error. We found that we could set the visibility timeout of the current processed message to 0, but it seems that the sqs polling system of lambda is deleting the message at the end of the run of our lambda.

Do you have a workaround to enable us to gracefully manage errors in our lambdas and release the message in the queue ?

Thanks !

Pag
asked a month ago340 views
1 Answer
0
Accepted Answer

Try using Partial batch responses. In this way you do not fail the Lambda, but you let the Lambda service know that you did not handle a message(s) in the batch.

profile pictureAWS
EXPERT
Uri
answered a month ago
profile picture
EXPERT
reviewed a month ago
  • Thanks for you answer, you recommend to use the Partial batch response even if my batch only contains 1 message ? (Because our lambda manage only 1 message a time). Also, it's a fifo queue that is connected to the lambda

  • Should work with both standard and FIFO and with a single message as well.

  • Thanks ! Will try that

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions