SNS Lambda Subscription Conflict
See original GitHub issueWhen subscribing multiple SNS Topics to a single Lambda Function, if two of those Topics have the same id
(scope-local - this could happen if those Topics are in different scopes) then the second subscription will fail to be created with:
A subscription with id "SomeId" already exists under the scope Stack/Resource
Reproduction Steps
See robwettach/sns-lambda-subscription-conflict
Error Log
A subscription with id "SomeId" already exists under the scope Stack/Resource
Environment
- CLI Version : 1.37.0 (build e4709de)
- Framework Version: 1.37.0
- OS : macOS Mojave 10.14.6
- Language : TypeScript (all)
Other
I believe changing this line from
subscriberId: topic.node.id,
to
subscriberId: topic.node.uniqueId,
will solve this issue.
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6
Top Results From Across the Web
Troubleshoot Amazon SNS not invoking a Lambda function
1. View your Lambda function's SNS topic subscription filter policy by doing the following: Open the Amazon SNS console. On the left navigation ......
Read more >AWS-Lambda and SNS : cross account - 2021 - BogoToBogo
From account B, subscribe the Lambda function to the topic. When a message is sent to the lambda-x-account topic in account A (047109936880),...
Read more >AWS Lambda triggered by SNS, can I catch exceptions from ...
It's not possible with a vanilla SNS trigger. The trigger has no knowledge of what happens after it fires. The easiest solution is...
Read more >Monitoring SNS Activity Using a Lambda Function and ...
To subscribe your Lambda function to the SNS topic you created, go back to the main Amazon Web Services page, and click the...
Read more >Building a CI/CD pipeline for an AWS Lambda function using ...
The integration layer of the serverless application uses S3 triggers to subscribe to the input events and an SNS client to write output ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just ran into the same problem. I also have an
sns.Topic
within a custom construct. @fwang, thanks for the PR!I have the same error message, but different setup. I’m importing the topic using:
And then I’m getting this error message:
My Lambda is wrapped over a custom construct, so I think it’s not only a problem of wrapping the Topic in a custom construct
I also managed to workaround it, by extracting the
sns.Topic.fromTopicArn( [...] )
call out of custom Lambda construct to one level up and then passing it as props.