From fe656af00174fd134c29cbcf289f0e73f2e9db5c Mon Sep 17 00:00:00 2001 From: Stefan Wachter Date: Thu, 6 Feb 2025 23:26:45 +0100 Subject: [PATCH] fix(lambda-event-sources): `SelfManagedKafkaEventSource` cannot be used in NPM symlinked workspaces (#32937) ### Reason for this change Allow to use SelfManagedKafkaEventSource in symlinked setups. ### Description of changes Replace instanceof check by `Construct.isConstruct()` call. *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/aws-cdk-lib/aws-lambda-event-sources/lib/kafka.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-lambda-event-sources/lib/kafka.ts b/packages/aws-cdk-lib/aws-lambda-event-sources/lib/kafka.ts index a970d47c7d1b3..ecc426e448008 100644 --- a/packages/aws-cdk-lib/aws-lambda-event-sources/lib/kafka.ts +++ b/packages/aws-cdk-lib/aws-lambda-event-sources/lib/kafka.ts @@ -244,7 +244,7 @@ export class SelfManagedKafkaEventSource extends StreamEventSource { } public bind(target: lambda.IFunction) { - if (!(target instanceof Construct)) { throw new Error('Function is not a construct. Unexpected error.'); } + if (!(Construct.isConstruct(target))) { throw new Error('Function is not a construct. Unexpected error.'); } target.addEventSourceMapping( this.mappingId(target), this.enrichMappingOptions({