SQS maxReceiveCount

Hi,

I have a service that uses an SQS fifo queue as trigger for a lambda function. I’d like to have it re-try a few times before the message gets to the DLQ.

Here’s the relevant serverless.yml portion:

resources:
  Resources:
    TestQueue:
      Type: "AWS::SQS::Queue"
      Properties:
        QueueName: "test.fifo"
        FifoQueue: true
        VisibilityTimeout: 30
        MessageRetentionPeriod: 1440 # 24hs
        RedrivePolicy:
          deadLetterTargetArn:
            "Fn::GetAtt":
              - DeadLetterQueue
              - Arn
          maxReceiveCount: 2
    DeadLetterQueue:
      Type: "AWS::SQS::Queue"
      Properties:
        QueueName: "test-dlq.fifo"
        MessageRetentionPeriod: 604800 # 7 days in seconds
        FifoQueue: true

With this, the function tries 2 times before the message gets to the DLQ. I’d like to increase that, but when I try to deploy I get this error:

Serverless Error ---------------------------------------

An error occurred: LambdaEvConf - 1 validation error detected: Value '3' at 'maximumRetryAttempts' failed to satisfy constraint: Member must have value less than or equal to 2 (Service: AWSLambdaInternal; Status Code: 400; Error Code: ValidationException;

But when I look at the console, I can increase this number all the way to 1000:

image

So why is the limit 2 here?

It looks like some people had a similar question on a PR on GitHub, but I didn’t really see an answer there.

Thanks!