Skip to content

Commit

Permalink
fix(sns-subscriptions): cannot add Lambda Subscription when using a L…
Browse files Browse the repository at this point in the history
…ambda Construct from a different Construct Library (#26206)

Fix the "is construct" check to ensure one can add a LambdaSubscription to an sns topic using the "addSubscription" method regardless of whether it came from a symlinked construct library or not.

Closes #24788.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
mjeanroy committed Jul 3, 2023
1 parent 9364e94 commit 06b33d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-sns-subscriptions/lib/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class LambdaSubscription 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.fn instanceof Construct)) {
if (!Construct.isConstruct(this.fn)) {
throw new Error('The supplied lambda Function object must be an instance of Construct');
}

Expand Down

0 comments on commit 06b33d5

Please sign in to comment.