hey guys I'm trying to get an already existing sns...
# help
a
hey guys I'm trying to get an already existing sns topic and add subscribers to it following the docs this is what I have here
Copy code
new Topic(this, 'Topic', {
  subscribers: [networkHandleTicker],
  snsTopic: sns.Topic.fromTopicArn(this, 'TickPerSecondTopic', 'arn:aws:sns:us-east-2:xxxxxxxxxxxx:shared-sharedSubminute-tickPerSecondTopic'),
});
but I'm getting an error telling me
NetworkHandleTickerTickPerSecondTopicDA486C85 Topic does not exist (Service: AmazonSNS; Status Code: 404; Error Code: NotFound; Request ID: 3e76aefd-c5d9-5d10-8335-f75719c5fde6; Proxy: null)
I can confirm that the topic is there
a
check your existing topic’s region and the sst app’s region in sst.json, do they match?
a
@Ashishkumar Pandey yes they do match, both of them are in
us-east-2
a
weird, that doesn’t make sense. Do the aws credentials that you’re using with sst have access to the Topic? Are the credentials that you’re using for sst, of your own account or another IAM user?
a
it's the same account creds as with everything else in this stack, the stack that created that topic is different though but it's still under the same account, and those credentials have access to that topic
I can use aws cli to list and subscribe to that topic
a
the other topic is a part of the same sst app?
a
no, but that shouldn't matter though right?
a
no, it definitely shouldn’t. Just confirm the arn from the first app. it’s a long shot but there ccould be a mismatch.
f
hmm.. the code looks perfectly right
a
@Ashishkumar Pandey arn is copy pasted from aws console
f
Hey @Aram, I know you might have tried this already, but I would: 1. Run
aws sns get-topic-attributes --topic-arn arn:aws:sns:us-east-2:xxxxxxxxxxxx:shared-sharedSubminute-tickPerSecondTopic
in ur terminal and make sure it exists 2. In ur SST code, right above
new Topic
, import aws sdk and make the same
getTopicAttributes
call and make sure it exists there 3. After u run
sst deploy
, go into
.build/cdk.out
and inspect the CFN template and ensure the topic name/arn are correct 4. Go into CFN console, and ensure the stack is deployed to the correct account/region
Again, u might’ve checked all these.. but beyond that.. I’m not sure what else I’d check 😅
a
@Frank 🤦‍♂️ there was a topic name change from
-tickPerSecondTopic
to
-TickPerSecondTopic
, my bad, sorry for the headache and thanks a lot for the help, trying suggested option 1 revealed that actually))
f
lol glad u figured it out!