Skip to content
Shakeride

Guide · Updated

Why messages vanish: a field guide to dead-letter handling

A message that cannot be processed has to end somewhere a person can look at it. When it does not, it is retried until it expires and then it is simply gone, without an error anywhere.

What a dead-letter queue is for

In Amazon SQS, a redrive policy on a source queue names a dead-letter queue and a maximum receive count. A message received more times than that count without being deleted is moved to the dead-letter queue instead of being retried again.

Without that policy, a message that always fails keeps coming back until its retention period ends, and then it is deleted.

Checks when failed messages do not show up

Work from the source queue outwards.

  • Does the source queue have a redrive policy at all, and does it name the queue you are looking at?
  • Is the dead-letter queue the same type as the source: standard with standard, FIFO with FIFO?
  • Is the dead-letter queue's retention period long enough for someone to look before messages expire there too?
  • If a consumer reads in batches, does it report partial failures, or does one bad message fail the whole batch?

Containment is only half of it

A dead-letter queue that fills up silently is a slower way of losing messages. Put an alarm on its depth so that the first failed message reaches a person.

All guides

Practise on a real failure

A live AWS account, already broken, and a clock. Fix it with the console and command line, then read a report of how you worked.

Browse the challenge catalog