question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to publish to created topic

See original GitHub issue

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

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:12
  • Comments:7

github_iconTop GitHub Comments

7reactions
Miniveracommented, Nov 16, 2018

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.

0reactions
malaneycommented, Aug 29, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to publish in Kafka - Stack Overflow
I want to publish in Kafka topic I am unable to do so, the program halts. I am getting this error: KafkaTimeoutError: Failed...
Read more >
Unable to publish bot due to error in system topic
Hi everyone, I am trying to publish a PVA bot. When I try to do so, it says it is unable to publish...
Read more >
Troubleshoot Amazon SNS publishing and subscription issues
I can't publish or subscribe to an Amazon Simple Notification Service (Amazon SNS) topic. How do I troubleshoot the issue?
Read more >
Was working perfectly, now cannot create new topic - wordpress
The easiest way to get a detailed error message is to install Query Monitor – WordPress plugin | WordPress.org English (Canada) and then...
Read more >
Publish messages to topics | Cloud Pub/Sub - Google Cloud
Pub/Sub offers at-least-once message delivery and best-effort ordering to existing subscribers. The general flow for a publisher application is: Create a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found