Skip to content

SNS: unable to ConfirmSubscription: Topic not found #1808

@NoumanSaleem

Description

@NoumanSaleem

Hi all,

Thanks for your effort on localstack! I'm trying to locally test SNS (HTTP) w/ cloudwatch triggers, but am unable to get past confirming the subscription.

My application receives the following POST body when creating a subscription:

{"MessageId": "5cb062ad-0d4e-41e6-9a80-7053926b20b4", "Type": "SubscriptionConfirmation", "Timestamp": "2019-11-27T04:29:21.166530Z", "Message": "You have chosen to subscribe to the topic arn:aws:sns:us-e
ast-1:000000000000:lambda-xyz-errors.\nTo confirm the subscription, visit the SubscribeURL included in this message.", "TopicArn": "arn:aws:sns:us-east-1:000000000000:lambda-xyz-errors", "Token": "3f97b1$
2", "SubscribeURL": "http://b40035e82fc6:4575/?Action=ConfirmSubscription&TopicArn=arn:aws:sns:us-east-1:000000000000:lambda-xyz-errors&Token=3f97b192"}

If I curl the SubscribeURL, I get a topic does not exist error:

[I] ➜ curl -XGET -H 'Authorization: AWS4-HMAC-SHA256 Credential=AKIAIOSFODNN7EXAMPLE/20130524/us-east-1/sns/aws4_request,SignedHeaders=host;range;x-amz-date,Signature=fe5f80f77d5fa3beca038a248ff027d044534
2fe2855ddc963176630326f1024' http://localhost:4575/\?Action\=ConfirmSubscription\&TopicArn\=arn:aws:sns:us-east-1:000000000000:lambda-xyz-errors\&Token\=75f32aec
<ErrorResponse xmlns="http://sns.amazonaws.com/doc/2010-03-31/">
  <Error>
    <Type>Sender</Type>
    <Code>NotFound</Code>
    <Message>Topic does not exist</Message>
  </Error>
  <RequestId>9dd01905-5012-5f99-8663-4b3ecd0dfaef</RequestId>
</ErrorResponse>%

If I run list-topics against the container, I can see it exists:

docker-compose exec localstack awslocal sns list-topics
{
    "Topics": [
        {
            "TopicArn": "arn:aws:sns:us-east-1:000000000000:lambda-xyz-errors"
        }
    ]
}

The topic and subscription were created with:

awslocal sns create-topic --name lambda-xyz-errors
awslocal sns subscribe --topic-arn arn:aws:sns:us-east-1:000000000000:lambda-xyz-errors --protocol http --notification-endpoint "http://localhost:3000/"

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: configurationConfiguring LocalStackgood first issueGood item to work on for newcomerstype: questionPlease ask questions on our community slack (slack.localstack.cloud)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions