How to stop a Lambda function from retrying itself forever?

0

Hey guys, I've been working with SQS-Lambda connection and faced the problem that when something is going wrong with the Lambda function it starts to retry the Lambda code hundreds of times till I changed the corcurrency limit to 0. What is the best way to set a Lambda function to run just once, and if an error occurs doesn't retry to execute itself?

Many thanks!

asked 6 months ago358 views
1 Answer
1
Accepted Answer

Hello.

How about setting up an SQS dead letter queue so that once an error occurs, it sends to the dead letter queue?
https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-rule-dlq.html

I thought that setting the number of times to move to the dead letter queue (maxReceiveCount) to a low number such as 1 would prevent infinite retries.
https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-dead-letter-queues.html#sqs-dead-letter-queues-how-they-work

profile picture
EXPERT
answered 6 months ago

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