Skip to content

Commit

Permalink
only add dependency if topic is of type Topic
Browse files Browse the repository at this point in the history
  • Loading branch information
corymhall committed Nov 8, 2021
1 parent cbdff3d commit c69977b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-sns-subscriptions/lib/lambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class LambdaSubscription implements sns.ITopicSubscription {

// if the topic and function are created in different stacks
// then we need to make sure the topic is created first
if (topic.stack !== this.fn.stack) {
if (topic instanceof sns.Topic && topic.stack !== this.fn.stack) {
this.fn.stack.addDependency(topic.stack);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-sns-subscriptions/lib/sqs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class SqsSubscription implements sns.ITopicSubscription {

// if the topic and queue are created in different stacks
// then we need to make sure the topic is created first
if (topic.stack !== this.queue.stack) {
if (topic instanceof sns.Topic && topic.stack !== this.queue.stack) {
this.queue.stack.addDependency(topic.stack);
}

Expand Down

0 comments on commit c69977b

Please sign in to comment.