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

Subscribe to existing SNS topic #94

Closed
zachboyd opened this issue Jan 16, 2018 · 7 comments
Closed

Subscribe to existing SNS topic #94

zachboyd opened this issue Jan 16, 2018 · 7 comments
Labels
Milestone

Comments

@zachboyd
Copy link
Contributor

I am trying to subscribe to an existing SNS topic with the serverless-aws-alias plugin installed. When using an existing SNS topic it doesn't look like the subscription is actually created. I was able to replicate this using serverless 1.25 and serverless-aws-alias 1.5.1.

When navigating to the lambda alias and looking at the SNS trigger a message is shown on the bottom stating

"A subscription for arn on the topic topic name could not be found". The console gives an option to fix or delete.

Under CloudFormation resources I do not see an AWS::SNS::Subscription defined either.

It does work as expected with the alias plugin commented out in serverless.yml

@zachboyd zachboyd changed the title Subscribing to existing SNS topic Subscribe to existing SNS topic Jan 16, 2018
@HyperBrain
Copy link
Member

Can you check, if the SNS subscription is placed into the alias stack? It should be created there, because the alias is subscribed and not $LATEST.

Did it also not show up when you inspect the aliased version of the lambda instead of $LATEST?

@zachboyd
Copy link
Contributor Author

I actually see the AWS::SNS::Subscription resource on the non-aliased stack and to further validate when looking at the subscription registered on the SNS topic it doesn't look it has the alias on the end of the arn.

@zachboyd
Copy link
Contributor Author

Also should mention that this is just a straight sls deploy without specifying an explicit alias so this is for the default alias dev.

@HyperBrain
Copy link
Member

Ok. Then this is a bug in the plugin, that it does not adjust the subscription to point to the alias. Additionally, the alias should have a permissions object attached. Can you post the relevant parts of your serverless.yml, just to be sure?

@HyperBrain HyperBrain added the bug label Jan 16, 2018
@zachboyd
Copy link
Contributor Author

zachboyd commented Jan 17, 2018

Here is the entire serverless.yml. I went ahead and replicated using a sample project that I created.

service: serverless-alias-test

plugins:

  • serverless-aws-alias

provider:
name: aws
runtime: nodejs6.10

functions:
snsalias:
handler: handler.snsalias
events:
- sns: arn:aws:sns:us-east-1:XXXXXXXXXXXX:sns-alias-test

zachboyd pushed a commit to zachboyd/serverless-aws-alias that referenced this issue Jan 24, 2018
@HyperBrain HyperBrain added this to the 1.6.0 milestone Jan 24, 2018
HyperBrain added a commit that referenced this issue Jan 25, 2018
Added support to have an alias subscribe to an existing SNS topic #94
@HyperBrain
Copy link
Member

Released with 1.6.0

@obie
Copy link

obie commented Feb 11, 2019

I'm getting sporadic failures of a similar nature. Click on 'Fix' then 'Save' does indeed fix the issue, but having to add a manual verification of SNS subscriptions to our deployment process obviously sucks.

image

Context: I have a notifiers stack in my app that subscribes to topics defined in other services. Some of the subscriptions work, some don't. No discernible pattern to the failures. Checked the underlying CF templates and they look as they should. I was able to find two similar complaints in the SLS forum, but no answers. Commenting on this issue to see if I'm the only one or what.

defnotrobbie pushed a commit to 1stdibs/serverless-aws-alias that referenced this issue Nov 14, 2022
defnotrobbie pushed a commit to 1stdibs/serverless-aws-alias that referenced this issue Nov 14, 2022
…n-fix

Added support to have an alias subscribe to an existing SNS topic serverless-heaven#94
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants