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 !

1 Resposta
0
Resposta aceita

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
ESPECIALISTA
Uri
respondido há um mês
profile picture
ESPECIALISTA
avaliado há um mês
  • 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

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas