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
已提問 1 個月前檢視次數 358 次
1 個回答
0
已接受的答案

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
專家
Uri
已回答 1 個月前
profile picture
專家
已審閱 1 個月前
  • 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

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南