From e8a769b1a7013912197a07eeb62552967fa9e367 Mon Sep 17 00:00:00 2001 From: Kaizen Conroy <36202692+kaizen3031593@users.noreply.github.com> Date: Wed, 20 Apr 2022 18:12:06 -0400 Subject: [PATCH] fix(lambda-event-sources): unsupported property `onFailure` for KafkaEventSources (#19995) Closes #19917. Seems this was missed in a previous fix: https://github.com/aws/aws-cdk/pull/17965. Adding breaking changes to `allowed-breaking-changes.txt` because they never worked in the first place. ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- allowed-breaking-changes.txt | 6 +++++ .../aws-lambda-event-sources/lib/stream.ts | 22 +++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/allowed-breaking-changes.txt b/allowed-breaking-changes.txt index 6069472407d94..e091ccf78dfa9 100644 --- a/allowed-breaking-changes.txt +++ b/allowed-breaking-changes.txt @@ -130,3 +130,9 @@ removed:@aws-cdk/aws-s3.BucketProps.eventBridgeEnabled # changed the type of RDS's SnapshotCredentials.secret from Secret to ISecret, # shouldn't matter changed-type:@aws-cdk/aws-rds.SnapshotCredentials.secret + +# removed property from kafka eventsources as they are not supported +removed:@aws-cdk/aws-lambda-event-sources.BaseStreamEventSourceProps.onFailure +removed:@aws-cdk/aws-lambda-event-sources.KafkaEventSourceProps.onFailure +removed:@aws-cdk/aws-lambda-event-sources.ManagedKafkaEventSourceProps.onFailure +removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.onFailure \ No newline at end of file diff --git a/packages/@aws-cdk/aws-lambda-event-sources/lib/stream.ts b/packages/@aws-cdk/aws-lambda-event-sources/lib/stream.ts index 462387397b629..e8f7f2a40de3e 100644 --- a/packages/@aws-cdk/aws-lambda-event-sources/lib/stream.ts +++ b/packages/@aws-cdk/aws-lambda-event-sources/lib/stream.ts @@ -2,8 +2,8 @@ import * as lambda from '@aws-cdk/aws-lambda'; import { Duration } from '@aws-cdk/core'; /** - * The set of properties for event sources that follow the streaming model, - * such as, Dynamo, Kinesis and Kafka. + * The set of properties for streaming event sources shared by + * Dynamo, Kinesis and Kafka. */ export interface BaseStreamEventSourceProps{ /** @@ -21,13 +21,6 @@ export interface BaseStreamEventSourceProps{ */ readonly batchSize?: number; - /** - * An Amazon SQS queue or Amazon SNS topic destination for discarded records. - * - * @default discarded records are ignored - */ - readonly onFailure?: lambda.IEventSourceDlq; - /** * Where to begin consuming the stream. */ @@ -50,8 +43,8 @@ export interface BaseStreamEventSourceProps{ } /** - * The set of properties for event sources that follow the streaming model, - * such as, Dynamo, Kinesis. + * The set of properties for streaming event sources shared by + * Dynamo and Kinesis. */ export interface StreamEventSourceProps extends BaseStreamEventSourceProps { /** @@ -107,6 +100,13 @@ export interface StreamEventSourceProps extends BaseStreamEventSourceProps { * @default - None */ readonly tumblingWindow?: Duration; + + /** + * An Amazon SQS queue or Amazon SNS topic destination for discarded records. + * + * @default - discarded records are ignored + */ + readonly onFailure?: lambda.IEventSourceDlq; } /**