Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to publish to created topic #44

Open
ebmeierj opened this issue Feb 26, 2018 · 8 comments
Open

Unable to publish to created topic #44

ebmeierj opened this issue Feb 26, 2018 · 8 comments

Comments

@ebmeierj
Copy link

ebmeierj commented Feb 26, 2018

When I try to publish to the topic I just created I'm getting a An error occurred (NotFound) when calling the Publish operation: Topic not found error.

Reproduction case:

Start the sns/sqs servers using docker-compose:
cd examples
docker-compose up

Publish to the existing test1 topic
AWS_DEFAULT_REGION=us-east-1 AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar aws sns --endpoint-url http://localhost:9911 list-topics

{
    "Topics": [
        {
            "TopicArn": "arn:aws:sns:us-east-1:1465414804035:test1"
        }
    ]
}

AWS_DEFAULT_REGION=us-east-1 AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar aws sns --endpoint-url http://localhost:9911 publish --topic-arn arn:aws:sns:us-east-1:1465414804035:test1 --message 'TEST'

{
    "MessageId": "bcbded98-610f-4921-930b-286571588609"
}

This is all as expected - however when I create a new topic and publish to it I get
AWS_DEFAULT_REGION=us-east-1 AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar aws sns --endpoint-url http://localhost:9911 create-topic --name new

{
    "TopicArn": "arn:aws:sns:us-east-1:123456789012:new"
}

AWS_DEFAULT_REGION=us-east-1 AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar aws sns --endpoint-url http://localhost:9911 list-topics

{
    "Topics": [
        {
            "TopicArn": "arn:aws:sns:us-east-1:1465414804035:test1"
        }, 
        {
            "TopicArn": "arn:aws:sns:us-east-1:123456789012:new"
        }
    ]
}

AWS_DEFAULT_REGION=us-east-1 AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar aws sns --endpoint-url http://localhost:9911 publish --topic-arn arn:aws:sns:us-east-1:123456789012:new --message 'TEST'

An error occurred (NotFound) when calling the Publish operation: Topic not found: arn:aws:sns:us-east-1:123456789012:new

Am I doing something wrong here? Is this happening because I don't have any subscriptions for this topic?

Ubuntu 14.04, docker 17.09.1-ce, compose 1.18.0, aws cli 1.14.38

@kevinmic
Copy link

I am having the same problem with some of my topics. I tried out your question "Is this happening because I don't have any subscriptions for this topic" and my issue went away. Unfortunately I have situations in my test environment where I only want to create the topic and ignore the queue.

@tomerf-sndbox
Copy link

Very confusing, this behavior should be documented

@chensara
Copy link

chensara commented Aug 1, 2018

How do you handle the subscription confirmation? after subscribing to the topic and publishing to it, my endpoint doesn't get call...

@walhs
Copy link

walhs commented Aug 9, 2018

Anyone got success to publish a msg with some workaround ?

@Minivera
Copy link

From this line https://github.com/s12v/sns/blob/master/src/main/scala/me/snov/sns/actor/SubscribeActor.scala#L50

We can see that, to consider the topic as "found", we need an actual subscription. Using a command like this docker exec <CONTAINER_ID> sh -c 'aws sns --endpoint-url http://localhost:9911 subscribe --topic-arn arn:aws:sns:us-east-1:1465414804035:test1 --protocol email --notification-endpoint my-email@example.com' should make it work.

@andrey-bobryshev-90poe
Copy link

This needs to be added to documentation (and to docker-hub documentation as well)

@malaney
Copy link

malaney commented Aug 29, 2020

I was unable to get this to work even using the solution that @Minivera proposed above.

@jameskbride
Copy link

Is there a reason the subscriptions are required? I'm in a situation where I need to create the topic and publish to it but I don't have any subscriptions yet, as subscriptions are downstream of my current resources, and from a publishing standpoint I don't actually care what is subscribed.

How do we feel about updating the logic of SubscriberActor.fanOut() to no longer throw an exception when there are no subscriptions for a topic and to simply return Success instead? That looks like a straightforward fix (although it is a change in behavior) and I wouldn't mind putting together a PR for it.

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

No branches or pull requests

9 participants