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

(Lambda) DynamoDB to Lambda trigger batch size limit is just 1000 for CDK #19285

Closed
pratik-g16 opened this issue Mar 8, 2022 · 2 comments · Fixed by #19317
Closed

(Lambda) DynamoDB to Lambda trigger batch size limit is just 1000 for CDK #19285

pratik-g16 opened this issue Mar 8, 2022 · 2 comments · Fixed by #19317
Labels
@aws-cdk/aws-lambda Related to AWS Lambda bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Comments

@pratik-g16
Copy link

What is the problem?

While creating a trigger for Lambda using DynamoDB Streams as source, the CDK allows only 1000 to be set as the maximum batch size. However in the documentation and using the console, we can create a trigger with a maximum batch size of 10000 records.

Reproduction Steps

handler.addEventSource(
new DynamoEventSource(table, {
startingPosition: lambda.StartingPosition.LATEST,
batchSize: 10000 })
);

What did you expect to happen?

By this code i was expecting that a trigger will be created from DynamoDB to Lambda with a batch size of 10k records.

What actually happened?

Error: Maximum batch size must be between 1 and 1000 inclusive (given 10000)
error

CDK CLI Version

2.15.0

Framework Version

No response

Node.js Version

v16.14.0

OS

Mac Os

Language

Typescript

Language Version

4.6.2

Other information

No response

@pratik-g16 pratik-g16 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 8, 2022
@github-actions github-actions bot added the @aws-cdk/aws-lambda Related to AWS Lambda label Mar 8, 2022
@peterwoodworth
Copy link
Contributor

peterwoodworth commented Mar 9, 2022

The documentation in CloudFormation, which we are limited by, is incorrect (likely outdated, like this code)

You can work around this for now until we fix it with escape hatches

    for (const child of handler.node.children) {
      if (child instanceof EventSourceMapping) {
        let map = child as EventSourceMapping;
        let cfnmap = map.node.defaultChild as CfnEventSourceMapping
        cfnmap.addPropertyOverride('BatchSize', 10000)
      }
    }

@peterwoodworth peterwoodworth added effort/small Small work item – less than a day of effort p2 and removed needs-triage This issue or PR still needs to be triaged. labels Mar 9, 2022
@mergify mergify bot closed this as completed in #19317 Mar 10, 2022
mergify bot pushed a commit that referenced this issue Mar 10, 2022
fixes #19285 
I can successfully deploy a stack by overriding the batch size to 10000 - need to contact cloudformation team to update their docs

----

*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.

TheRealAmazonKendra pushed a commit to TheRealAmazonKendra/aws-cdk that referenced this issue Mar 11, 2022
fixes aws#19285 
I can successfully deploy a stack by overriding the batch size to 10000 - need to contact cloudformation team to update their docs

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
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. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants