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

fix(lambda-event-sources): increase batch size restriction #19317

Merged
merged 2 commits into from
Mar 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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