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
질문됨 한 달 전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
답변함 한 달 전
profile picture
전문가
검토됨 한 달 전
  • 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

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠