Skip to content

Commit

Permalink
fix: only push valid subscriptions (#172)
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Mills <[email protected]>
  • Loading branch information
thejuan and Adam Mills authored Oct 29, 2023
1 parent d51e1b8 commit 9032a77
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,16 @@ class ServerlessOfflineSns {
const topicArn = get(["Properties", "TopicArn", "Ref"], value);
const topicName = get(["Properties", "TopicName"], resources[topicArn]);
const fnName = this.getFunctionName(resourceName);

if(!topicName){
this.log(`${fnName} does not have a topic name, skipping`);
return;
}

if(!fnName){
this.log(`${topicName} does not have a function, skipping`);
return;
}
subscriptions.push({
fnName,
options: {
Expand Down

0 comments on commit 9032a77

Please sign in to comment.