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 #10486

Closed
sekerjak opened this issue Sep 22, 2020 · 2 comments · Fixed by #10603
Closed

[aws-lambda] EventSourceMappingOptions default values for Construct Props #10486

sekerjak opened this issue Sep 22, 2020 · 2 comments · Fixed by #10603
Assignees
Labels
@aws-cdk/aws-lambda Related to AWS Lambda documentation This is a problem with documentation. guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged.

Comments

@sekerjak
Copy link

sekerjak commented Sep 22, 2020

Dear community,

I am interested in EventSourceMappingOptions, especially retry_attempts 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:

retryAttempts?
Type: number (optional, default: 10000)
The maximum number of times to retry when the function returns an error.

Valid Range:

Minimum value of 0
Maximum value of 10000

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

MaximumRetryAttempts
(Streams) Discard records after the specified number of retries. The default value is infinite (-1). When set to infinite (-1), failed records will be retried until the record expires.

Type: Integer

Valid Range: Minimum value of 0. Maximum value of 10000.

Required: No

So I expected, that default value will be 10 000 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: None
Concurrent batches per shard: 1
Last processing result: No records processed
Maximum age of record: -1
On-failure destination:
{
  "onFailure": {}
}
Retry attempts: -1  
Split batch on error: No

I expected 10 000 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)

PS: The similar "issue" is with the Maximum age of record as well I think, as documentation is saying 7 days, but I see -1 (infinite). Am I doing something wrong?

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 Sep 22, 2020
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Sep 22, 2020
@sekerjak sekerjak changed the title [aws-lambda] [aws-lambda] EventSourceMappingOptions default values for Construct Props Sep 22, 2020
@nija-at
Copy link
Contributor

nija-at commented Sep 30, 2020

@sekerjak - thanks for bringing this to our attention. The documentation on the CDK side is indeed inaccurate. The default is infinite. The minimum configurable value is 0 and the maximum configurable value is 10000.

Apologies for the error.

@nija-at nija-at added guidance Question that needs advice or information. and removed feature-request A feature should be added or improved. labels Sep 30, 2020
@mergify mergify bot closed this as completed in #10603 Sep 30, 2020
mergify bot pushed a commit that referenced this issue Sep 30, 2020
The default value was incorrectly documented as 10000, while in fact, it
is infinite.

Ref: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lambda-eventsourcemapping.html#cfn-lambda-eventsourcemapping-maximumretryattempts

closes #10486


----

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

sekerjak commented Sep 30, 2020

Hey @nija-at,

I saw your commit, thank you for your resolution, but I think, that there is the same problem with **Maximum age of record ** parameter as well. I mentioned it in my last paragraph, but I didn't emphasize it too much.

PS: Opened new issue #10693

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 documentation This is a problem with documentation. guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants