Is it true that the "Redrive to source queue(s)" option in the AWS console will not work for messages that have been manually sent to the DLQ by a Lambda function

0

I've a lambda that processes messages from SQS.

The input queue has a redrive policy that causes messages to be moved to a DLQ if the lambda fails to process them after repeated attempts. This arrangement works and, if there are messages in the DLQ, I can send them back to the source queue using the the AWS console "Start DLQ redrive" button, along with the "Redrive to source queue(s)" option.

For some messages, however, the lambda function decides to push them directly to the DLQ. For those messages, however, when I try a DLQ redrive using the "Redrive to source queue(s)" option, it fails with "Failed: CouldNotDetermineMessageSource". Is there any way that I can avoid this message, or does the "Redrive to source queue(s)" option only work for messages put in the DLQ by the AWS runtime ?

1 Answer
0

I believe when you run the redrive you also have the option of chosing the SQS queue you wish to drive them too. The other option is send them back to the source queue.

So techinically you can redrive the messages to ANY queue..

Manually choose a queue to redrive too in this instance

To prevent it happening you need to look at your lambda function..

If your function fails to process a message multiple times, Amazon SQS can send it to a dead-letter queue. If your function returns an error, all items in the batch return to the queue. After the visibility timeout occurs, Lambda receives the message again. To send messages to a second queue after a number of receives, configure a dead-letter queue on your source queue.

NOTE

Make sure that you configure the dead-letter queue on the source queue, not on the Lambda function. The dead-letter queue that you configure on a function is used for the function's asynchronous invocation queue, not for event source queues.
profile picture
EXPERT
answered a year ago
  • Yes, you are right - there is an option "Redrive to a custom destination" that allows the user to choose any queue. However, the problem with that option is that it relies on the user to choose the correct queue to redrive to. If you have many queues, it's easy to pick the wrong one. Since there is an option to send them to the source queue, I'd like to know how to get that to work for messages in the DLQ that were pushed there by the lambda.

  • hey Peter, you need to ensure your lamda function is processing the messages correctly and failing them correctly so SQS moves the messages to the DLQ

    https://docs.aws.amazon.com/lambda/latest/dg/with-sqs.html#services-sqs-batchfailurereporting

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