-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_lambda_event_sources: Missing support for maxRecordAge=-1 value in KinesisEventSourceProps #27321
Comments
Thanks for reporting, we may want to allow an override on Duration to allow this to work. For now, you can work around this by overriding the template with escape hatches |
Just FYI for who doesn't know, The default value for E.g.:
|
Thank you @roger-zhangg for your comment here. Since you can get the value of -1 by leaving this undefined, this seems like a documentation/doc string update is needed rather than a code change. We should update the docstring here to reflect that not setting this value will result in |
Thanks for the suggestion, I'll take a look at how retention period might affect the maxRecordAge. Update: E.g const fn = new TestFunction(this, 'F');
const stream = new kinesis.Stream(this, 'Q', {retentionPeriod: cdk.Duration.days(7)});
const eventSource = new KinesisEventSource(stream, {
startingPosition: lambda.StartingPosition.TRIM_HORIZON,
tumblingWindow: cdk.Duration.seconds(60),
});
fn.addEventSource(eventSource); Output |
…ps (#29582) ### Issue # (if applicable) Closes #27321 ### Reason for this change Our customer found `maxRecordAge` can't be set to `-1` Due to limitation of `cdk.Duration`. However, it's not obvious in the docstring that the [default value](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-maximumrecordageinseconds) of `maxRecordAge` is already -1. Our customer can simply leave this prop empty to set it to -1. So, This PR improves the docstring to make default value more apparent. See more discussion in the ticket. ### Description of changes Improve docstring of `maxRecordAge` and `retryAttempts` in `KinesisEventSourceProps` in `aws-lambda-event-source` ### Description of how you validated changes ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Describe the bug
The service supports -1 as a value but CDK imposes a Duration object which does not support negative value. This can become an issue in case the Kinesis Stream Retention window is set to > 7 days (which is the max allowed for maxRecordAge). when this happens customer may lose records.
Expected Behavior
the KinesisEventSourceProps should support a way to set the maxRecordAge value to -1. (Duration(-1)?)
Current Behavior
Duration(-1) is not allowed and no other way to set this value
Reproduction Steps
self explanatory
Possible Solution
allow Duration.seconds(-1) as a way to pass through the value?
Additional Information/Context
No response
CDK CLI Version
latest
Framework Version
No response
Node.js Version
all
OS
all
Language
Typescript
Language Version
all
Other information
No response
The text was updated successfully, but these errors were encountered: