I am receiving the following error from a Lambda that is pulling and deleting messages from a SQS standard queue using the aws-sdk:
{
"errorType": "ReceiptHandleIsInvalid",
"errorMessage": "The receipt handle \"some-long-string\" is not valid for this queue.",
"code": "ReceiptHandleIsInvalid",
"stack": [
"ReceiptHandleIsInvalid: The receipt handle \"some-long-string\" is not valid for this queue.",
],
"message": "The receipt handle \"some-long-string\" is not valid for this queue.",
"time": "2019-07-25T23:01:38.402Z",
"requestId": "a1e5b6c2-4424-540c-9ce7-e376733674c8",
"statusCode": 404,
"retryable": false,
"retryDelay": 55.62516824566506
}
The Lambdas are taking 150-400ms to process and it seems to fail on the deleteMessage action at the end of the Lambda. Docs say it's due to an invalid receipt handle but what makes it invalid? Is the message no longer in the queue?
The queue has a MessageRetentionPeriod to 14 days and the Lambdas has a batchSize of 1 and a reservedConcurrency of 1 as well.
I'm suspecting that this lambda is continuing to process many of the same messages and failing to delete them. As of this moment there are 2,616 messages available and 14 in-flight. We should be seeing at most 50-100 messages in the queue.
Any ideas? What could be causing this?
EDIT 1: 4 hours later the available messages is at 2,609 and 46 in-flight.