mapbox / mapbox/magic-cfn-resources

remove SnsSubscriptions from oldTopic

Open
#42 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6
Forks
4
PR merge metrics
No merged PRs in 30d

Description

The SnsSubscription function manages to remove old subscriptions in the _current_ topic when searching for subscriptions [here](https://github.com/mapbox/magic-cfn-resources/blob/7571a63189e18e22c5b8369ab1989e8d8ef43bf0/functions/sns-subscription.js#L105-L110) but it does not remove subscriptions if the topic has changed in a stack update.

For example:

1. stack update subscribes `Endpoint1` to `TopicA`
2. then stack is updated to subscribe `Endpoint1` to `TopicB` instead of `TopicA`

The `delete` method does not search `TopicA` for subscriptions to remove, only `TopicB` to avoid duplicate subscriptions. This means `Endpoint1` will continue to receive messages from `TopicA` until it the subscription is manually deleted by an engineer.

We should update the lambda function to search for subscriptions in the oldTopic and newTopic.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in functions/sns-subscription.js around lines 105-110 and trace how the delete method searches for subscriptions during a stack update. Verify how oldTopic and newTopic are provided; done when subscriptions are removed from both topics without creating duplicate subscriptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript
Domain
cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.