From 52eee859d227a854c46d6975fcec2b4b10719097 Mon Sep 17 00:00:00 2001 From: Gaston Silva Date: Thu, 5 Oct 2023 13:54:11 -0300 Subject: [PATCH] fix(sns-subscriptions): cannot add SqsSubscription when using an Sqs Construct from a different Constructs library (#27227) Fix the "is construct" check to ensure one can add an SqsSubscription to an sns topic using the "addSubscription" method regardless of whether it came from a symlinked construct library or not. Closes #27225 ---- *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-sns-subscriptions/lib/sqs.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/aws-cdk-lib/aws-sns-subscriptions/lib/sqs.ts b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/sqs.ts index c98808c063a48..f713fe6bb6ead 100644 --- a/packages/aws-cdk-lib/aws-sns-subscriptions/lib/sqs.ts +++ b/packages/aws-cdk-lib/aws-sns-subscriptions/lib/sqs.ts @@ -33,7 +33,7 @@ export class SqsSubscription implements sns.ITopicSubscription { public bind(topic: sns.ITopic): sns.TopicSubscriptionConfig { // Create subscription under *consuming* construct to make sure it ends up // in the correct stack in cases of cross-stack subscriptions. - if (!(this.queue instanceof Construct)) { + if (!Construct.isConstruct(this.queue)) { throw new Error('The supplied Queue object must be an instance of Construct'); } const snsServicePrincipal = new iam.ServicePrincipal('sns.amazonaws.com');