Skip to content

Commit

Permalink
fix(lambda-event-sources): increase batch size restriction (aws#19317)
Browse files Browse the repository at this point in the history
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*
  • Loading branch information
peterwoodworth authored and TheRealAmazonKendra committed Mar 11, 2022
1 parent 1564dfd commit 2696079
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-lambda-event-sources/lib/dynamodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export class DynamoEventSource extends StreamEventSource {

if (this.props.batchSize !== undefined
&& !Token.isUnresolved(this.props.batchSize)
&& (this.props.batchSize < 1 || this.props.batchSize > 1000)) {
throw new Error(`Maximum batch size must be between 1 and 1000 inclusive (given ${this.props.batchSize})`);
&& (this.props.batchSize < 1 || this.props.batchSize > 10000)) {
throw new Error(`Maximum batch size must be between 1 and 10000 inclusive (given ${this.props.batchSize})`);
}
}

Expand Down
14 changes: 7 additions & 7 deletions packages/@aws-cdk/aws-lambda-event-sources/test/dynamo.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('DynamoEventSource', () => {

// WHEN
fn.addEventSource(new sources.DynamoEventSource(table, {
batchSize: 50,
batchSize: 5000,
startingPosition: lambda.StartingPosition.LATEST,
}));

Expand All @@ -131,7 +131,7 @@ describe('DynamoEventSource', () => {
'FunctionName': {
'Ref': 'Fn9270CBC0',
},
'BatchSize': 50,
'BatchSize': 5000,
'StartingPosition': 'LATEST',
});

Expand All @@ -153,7 +153,7 @@ describe('DynamoEventSource', () => {
type: 'Number',
default: 100,
minValue: 1,
maxValue: 1000,
maxValue: 10000,
});
// WHEN
fn.addEventSource(new sources.DynamoEventSource(table, {
Expand Down Expand Up @@ -217,12 +217,12 @@ describe('DynamoEventSource', () => {
expect(() => fn.addEventSource(new sources.DynamoEventSource(table, {
batchSize: 0,
startingPosition: lambda.StartingPosition.LATEST,
}))).toThrow(/Maximum batch size must be between 1 and 1000 inclusive \(given 0\)/);
}))).toThrow(/Maximum batch size must be between 1 and 10000 inclusive \(given 0\)/);


});

test('fails if batch size > 1000', () => {
test('fails if batch size > 10000', () => {
// GIVEN
const stack = new cdk.Stack();
const fn = new TestFunction(stack, 'Fn');
Expand All @@ -236,9 +236,9 @@ describe('DynamoEventSource', () => {

// WHEN
expect(() => fn.addEventSource(new sources.DynamoEventSource(table, {
batchSize: 1001,
batchSize: 10001,
startingPosition: lambda.StartingPosition.LATEST,
}))).toThrow(/Maximum batch size must be between 1 and 1000 inclusive \(given 1001\)/);
}))).toThrow(/Maximum batch size must be between 1 and 10000 inclusive \(given 10001\)/);


});
Expand Down

0 comments on commit 2696079

Please sign in to comment.