Skip to content
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] EventSourceMappingOptions default values for Construct Props maxRecordAge #10693

Closed
sekerjak opened this issue Oct 5, 2020 · 2 comments · Fixed by #11018
Closed
Assignees
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. documentation This is a problem with documentation. effort/small Small work item – less than a day of effort needs-triage This issue or PR still needs to be triaged. p2

Comments

@sekerjak
Copy link

sekerjak commented Oct 5, 2020

Dear community,

I am interested in EventSourceMappingOptions, especially max_record_age parameter mentioned here https://docs.aws.amazon.com/cdk/api/latest/python/aws_cdk.aws_lambda/EventSourceMappingOptions.html and here https://docs.aws.amazon.com/cdk/api/latest/docs/@aws-cdk_aws-lambda.EventSourceMappingOptions.html. The documentation is mentioning following:

Type: Duration (optional, default: Duration.days(7))

The maximum age of a record that Lambda sends to a function for processing.

Valid Range:

Minimum value of 60 seconds
Maximum value of 7 days

BUT this documentation https://docs.aws.amazon.com/lambda/latest/dg/API_CreateEventSourceMapping.html is mentioning the following:

MaximumRecordAgeInSeconds
(Streams) Discard records older than the specified age. The default value is infinite (-1).

Type: Integer

Valid Range: Minimum value of 60. Maximum value of 604800.

Required: No

So I expected, that default value will be 7 days and not infinite as it's mentioned above, so I tried following:

  fn = aws_lambda.Function(self.stack, "failing-lambda",
                                 code=aws_lambda.Code.from_inline(lambda_code),
                                 runtime=aws_lambda.Runtime.PYTHON_3_7,
                                 handler='index.failing_lambda',
                                 function_name=self.workspace.name_for("failing-lambda"),
                                 timeout=Duration.seconds(30)
                                 )

   fn.add_event_source_mapping(id="errout-mapping", event_source_arn=consumer.attr_consumer_arn,
                                    starting_position=aws_lambda.StartingPosition.LATEST,
                                    batch_size=500)

And when I opened Lambda Designer in AWS console I saw the following values:

Batch size: 500
Batch window: 1
Concurrent batches per shard: 1
Last processing result: OK
Maximum age of record: -1
On-failure destination:
{
  "onFailure": {}
}
Retry attempts: -1
Split batch on error: No

I expected 7 days as is mentioned in the documentation, but it was set to infinite (btw, I am fine with infinite, but I wanted to make sure, that it will not change in the future and infinite as default is expected)

Thank you, Jakub.


This is a 📕 documentation issue

@sekerjak sekerjak added documentation This is a problem with documentation. feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Oct 5, 2020
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Oct 5, 2020
@nija-at nija-at removed the feature-request A feature should be added or improved. label Oct 12, 2020
@SomayaB SomayaB added the bug This issue is a bug. label Oct 19, 2020
@nija-at
Copy link
Contributor

nija-at commented Oct 21, 2020

CDK's documentation is incorrect. The default value is infinite.

@nija-at nija-at added effort/small Small work item – less than a day of effort p2 labels Oct 21, 2020
@mergify mergify bot closed this as completed in #11018 Oct 21, 2020
mergify bot pushed a commit that referenced this issue Oct 21, 2020
…ceMapping (#11018)

closes #10693


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. documentation This is a problem with documentation. effort/small Small work item – less than a day of effort needs-triage This issue or PR still needs to be triaged. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants