Skip to content

Commit 1bc5144

Browse files
fix(lambda-event-sources): increase batch size restriction (#19317)
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*
1 parent bbed27d commit 1bc5144

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

packages/@aws-cdk/aws-lambda-event-sources/lib/dynamodb.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export class DynamoEventSource extends StreamEventSource {
1717

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

packages/@aws-cdk/aws-lambda-event-sources/test/dynamo.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ describe('DynamoEventSource', () => {
116116

117117
// WHEN
118118
fn.addEventSource(new sources.DynamoEventSource(table, {
119-
batchSize: 50,
119+
batchSize: 5000,
120120
startingPosition: lambda.StartingPosition.LATEST,
121121
}));
122122

@@ -131,7 +131,7 @@ describe('DynamoEventSource', () => {
131131
'FunctionName': {
132132
'Ref': 'Fn9270CBC0',
133133
},
134-
'BatchSize': 50,
134+
'BatchSize': 5000,
135135
'StartingPosition': 'LATEST',
136136
});
137137

@@ -153,7 +153,7 @@ describe('DynamoEventSource', () => {
153153
type: 'Number',
154154
default: 100,
155155
minValue: 1,
156-
maxValue: 1000,
156+
maxValue: 10000,
157157
});
158158
// WHEN
159159
fn.addEventSource(new sources.DynamoEventSource(table, {
@@ -217,12 +217,12 @@ describe('DynamoEventSource', () => {
217217
expect(() => fn.addEventSource(new sources.DynamoEventSource(table, {
218218
batchSize: 0,
219219
startingPosition: lambda.StartingPosition.LATEST,
220-
}))).toThrow(/Maximum batch size must be between 1 and 1000 inclusive \(given 0\)/);
220+
}))).toThrow(/Maximum batch size must be between 1 and 10000 inclusive \(given 0\)/);
221221

222222

223223
});
224224

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

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

243243

244244
});

0 commit comments

Comments
 (0)