I am trying to do a chalice deploy to a localstack inside a docker compose on MacOS. It is failing on a missing SNS topic. But the topic exists. I have tried localstack 2.0.2 and 2.1.
From the logs, it appears the KeyError ‘arn:aws:sns:eu-west-1:000000000000:TranscribeComplete’ is the source of the problem. This is odd because the topic exists based on the awslocal sns list-topics command. See below, appreciate any help with what I’m doing wrong or if I’ve hit a bug.
localstack log:
backend-chalice-test-localstack-1 | 2023-07-16T22:29:11.292 ERROR — [ asgi_gw_3] l.aws.handlers.logging : exception during call chain
backend-chalice-test-localstack-1 | Traceback (most recent call last):
backend-chalice-test-localstack-1 | File “/opt/code/localstack/localstack/aws/chain.py”, line 90, in handle
backend-chalice-test-localstack-1 | handler(self, self.context, response)
backend-chalice-test-localstack-1 | File “/opt/code/localstack/localstack/aws/handlers/service.py”, line 123, in call
backend-chalice-test-localstack-1 | handler(chain, context, response)
backend-chalice-test-localstack-1 | File “/opt/code/localstack/localstack/aws/handlers/service.py”, line 93, in call
backend-chalice-test-localstack-1 | skeleton_response = self.skeleton.invoke(context)
backend-chalice-test-localstack-1 | File “/opt/code/localstack/localstack/aws/skeleton.py”, line 154, in invoke
backend-chalice-test-localstack-1 | return self.dispatch_request(context, instance)
backend-chalice-test-localstack-1 | File “/opt/code/localstack/localstack/aws/skeleton.py”, line 166, in dispatch_request
backend-chalice-test-localstack-1 | result = handler(context, instance) or {}
backend-chalice-test-localstack-1 | File “/opt/code/localstack/localstack/aws/forwarder.py”, line 60, in _call
backend-chalice-test-localstack-1 | return handler(context, req)
backend-chalice-test-localstack-1 | File “/opt/code/localstack/localstack/aws/skeleton.py”, line 118, in call
backend-chalice-test-localstack-1 | return self.fn(*args, **kwargs)
backend-chalice-test-localstack-1 | File “/opt/code/localstack/localstack/services/sns/provider.py”, line 733, in subscribe
backend-chalice-test-localstack-1 | for existing_topic_subscription in store.topic_subscriptions[topic_arn]:
> backend-chalice-test-localstack-1 | KeyError: ‘arn:aws:sns:eu-west-1:000000000000:TranscribeComplete’
backend-chalice-test-localstack-1 | 2023-07-16T22:29:11.296 INFO — [ asgi_gw_3] localstack.request.aws : AWS sns.Subscribe => 500 (InternalError)
command line of localstack docker:
# awslocal sns list-topics
{
"Topics": [
{
"TopicArn": "arn:aws:sns:eu-west-1:000000000000:TranscribeComplete"
}
]
}
Relevant code in app.py:
SNS_TOPIC = 'arn:aws:sns:eu-west-1:000000000000:TranscribeComplete'
@app.on_sns_message(topic=SNS_TOPIC)
def process_transcript(event):
.
.
.