Skip to content

aws-lambda-event-sources: Inconsistency in KinesisEventSource.retryAttempts validation #34007

@garysassano

Description

@garysassano

Describe the bug

There's an inconsistency in the AWS CDK Kinesis event source mapping validation. According to the documentation, -1 is the default value for retryAttempts which should set retries to infinite. However, when explicitly setting this value to -1, validation fails with:

ValidationError: retryAttempts must be between 0 and 10000 inclusive, got -1
  at path [X] in aws-cdk-lib.aws_lambda.EventSourceMapping

Documentation Reference

Image

Steps to Reproduce

new KinesisEventSource(telemetryStream, {
  startingPosition: StartingPosition.LATEST,
  batchSize: 10000,
  maxBatchingWindow: Duration.seconds(30),
  parallelizationFactor: 1,
  retryAttempts: -1, // This fails validation
  reportBatchItemFailures: false,
  bisectBatchOnError: false
});

Expected Behavior

Since -1 is documented as the default value that sets retries to infinite, it should be accepted by the validation.

Actual Behavior

Validation fails with: retryAttempts must be between 0 and 10000 inclusive, got -1

Workaround

The only current workaround is to omit the retryAttempts property entirely to use the default, or set it to a value between 0 and 10000.

CDK CLI Version

2.1006.0

Framework Version

No response

Node.js Version

22.14.0

OS

Ubuntu 24.04

Language

TypeScript

Language Version

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions