Skip to content

fix sns unsubscribe to be idempotent#7901

Merged
thrau merged 1 commit intomasterfrom
fix-sns-unsubscribe
Mar 18, 2023
Merged

fix sns unsubscribe to be idempotent#7901
thrau merged 1 commit intomasterfrom
fix-sns-unsubscribe

Conversation

@thrau
Copy link
Member

@thrau thrau commented Mar 17, 2023

Small fix that makes sure there's no exception when sns unsubscribe is called twice (which happens a decent amount of times in tests).

Logs had quite a few of these errors:

2023-03-17T16:38:29.4143947Z ------------------------------ live log teardown -------------------------------
2023-03-17T16:38:29.4144724Z 2023-03-17T16:38:29.412 ERROR --- [   asgi_gw_3] localstack.aws.handlers.logging : exception during call chain
2023-03-17T16:38:29.4146180Z Traceback (most recent call last):
2023-03-17T16:38:29.4146706Z   File "/home/runner/work/localstack/localstack/localstack/localstack/aws/chain.py", line 90, in handle
2023-03-17T16:38:29.4147135Z     handler(self, self.context, response)
2023-03-17T16:38:29.4147637Z   File "/home/runner/work/localstack/localstack/localstack/localstack/aws/handlers/service.py", line 122, in __call__
2023-03-17T16:38:29.4148043Z     handler(chain, context, response)
2023-03-17T16:38:29.4148523Z   File "/home/runner/work/localstack/localstack/localstack/localstack/aws/handlers/service.py", line 92, in __call__
2023-03-17T16:38:29.4148972Z     skeleton_response = self.skeleton.invoke(context)
2023-03-17T16:38:29.4149483Z   File "/home/runner/work/localstack/localstack/localstack/localstack/aws/skeleton.py", line 153, in invoke
2023-03-17T16:38:29.4149933Z     return self.dispatch_request(context, instance)
2023-03-17T16:38:29.4150443Z   File "/home/runner/work/localstack/localstack/localstack/localstack/aws/skeleton.py", line 165, in dispatch_request
2023-03-17T16:38:29.4150877Z     result = handler(context, instance) or {}
2023-03-17T16:38:29.4151347Z   File "/home/runner/work/localstack/localstack/localstack/localstack/aws/forwarder.py", line 60, in _call
2023-03-17T16:38:29.4151737Z     return handler(context, req)
2023-03-17T16:38:29.4152197Z   File "/home/runner/work/localstack/localstack/localstack/localstack/aws/skeleton.py", line 117, in __call__
2023-03-17T16:38:29.4152577Z     return self.fn(*args, **kwargs)
2023-03-17T16:38:29.4153072Z   File "/home/runner/work/localstack/localstack/localstack/localstack/services/sns/provider.py", line 484, in unsubscribe
2023-03-17T16:38:29.4153525Z     if subscription["Protocol"] in ["http", "https"]:
2023-03-17T16:38:29.4154012Z TypeError: 'NoneType' object is not subscriptable
2023-03-17T16:38:29.4170528Z 2023-03-17T16:38:29.416  INFO --- [   asgi_gw_3] localstack.request.aws     : AWS sns.Unsubscribe => 500 (InternalError)

@thrau thrau requested a review from bentsku as a code owner March 17, 2023 18:41
@thrau thrau temporarily deployed to localstack-ext-tests March 17, 2023 18:41 — with GitHub Actions Inactive
@thrau thrau force-pushed the fix-sns-unsubscribe branch from dd61a65 to 9d72d24 Compare March 17, 2023 18:42
@thrau thrau temporarily deployed to localstack-ext-tests March 17, 2023 18:42 — with GitHub Actions Inactive
@github-actions
Copy link

LocalStack integration with Pro

       3 files  ±0         3 suites  ±0   1h 42m 47s ⏱️ +6s
1 808 tests +1  1 426 ✔️ +1  382 💤 ±0  0 ±0 
2 526 runs  +1  1 792 ✔️ +1  734 💤 ±0  0 ±0 

Results for commit 9d72d24. ± Comparison against base commit f771a97.

Copy link
Contributor

@bentsku bentsku left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 😄 thanks a lot for doing this, one less TODO!

@thrau thrau merged commit 029d8b4 into master Mar 18, 2023
@thrau thrau deleted the fix-sns-unsubscribe branch March 18, 2023 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants