No bugs in codes, why messages are still being sent to Dead Letter Queue?

3k views Asked by At

I have 2 Lambda functions that respectively sent and received some workloads via a SQS. But many messages are unexpectedly sent to DLQ. I am confident that it wasn't caused by in-code bugs because not all messages went to DLQ.

I set reservedConcurrentExecutions = 1 and maxReceiveCount = 1, does it matter? I'm thinking if I increase maxReceiveCount perhaps fewer messages will be sent to DLQ.

Anyhow, I hope somebody can walk me through the methodology behind that.

1

There are 1 answers

0
Memphis Meng On BEST ANSWER

Increasing maxReceiveCount worked eventually. The official developer guide says:

If your function returns an error, or can't be invoked because it's at maximum concurrency, processing might succeed with additional attempts. To give messages a better chance to be processed before sending them to the dead-letter queue, set the maxReceiveCount on the source queue's redrive policy to at least 5.