(sns): fifo topic construct doesn't append .fifo to the topic name
See original GitHub issueThe SNS FIFO topics are failing to deploy because the topic name is missing .fifo
at the end.
Reproduction Steps
Create a minimal cdk app with the following SNS FIFO topic and deploy it:
import * as sns from "@aws-cdk/aws-sns";
import * as cdk from "@aws-cdk/core";
class MyStack extends cdk.Stack {
constructor(scope: cdk.Construct, id: string, properties?: cdk.StackProps) {
super(scope, id, properties);
new sns.Topic(this, "MyTopic", {
fifo: true,
});
}
}
const app = new cdk.App();
new MyStack(app, "MyStack");
What did you expect to happen?
The SNS topic should append .fifo
to the topic name if topic: true
and .fifo
is not present already.
What actually happened?
The deploy failed:
9:48:48 PM | CREATE_FAILED | AWS::SNS::Topic | FanOutTopic
Invalid parameter: Topic Name (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: xxxxx-xxxx-xxxx-xxxxx; Proxy: null)
Environment
- CDK CLI Version : v1.83.0
- Framework Version: v1.83.0
- Node.js Version: v12.20.0
- OS : Ubuntu 20
- Language (Version): TypeScript (4.1)
Other
It works if you manually set the topicName to include .fifo
at the end, like this:
new sns.Topic(this, "MyTopic", {
fifo: true,
topicName: "MyTopic.fifo",
});
This is 🐛 Bug Report
Issue Analytics
- State:
- Created 3 years ago
- Comments:11 (10 by maintainers)
Top Results From Across the Web
Code examples for FIFO topics - AWS Documentation
Using an AWS SDK, you create an Amazon SNS FIFO topic by setting its FifoTopic attribute to true. You create an Amazon SQS...
Read more >SNS FIFO Topic Doesn't fan out messages to SQS FIFO queue
I am able to get PublishResult#getMessageId() means the publishing part is happening successfully but the queue doesn't have any messages in it.
Read more >@aws-cdk/aws-sns - npm
Note that FIFO topics require a topic name to be provided. The required .fifo suffix will be automatically added to the topic name...
Read more >3 surprising facts about AWS SQS FIFO queues - Tom Gregory
QUEUE_URL=$(aws sqs create-queue --queue-name test.fifo --attributes FifoQueue=true,ContentBasedDeduplication=true --query QueueUrl --output ...
Read more >so1omon563/sns/aws - Terraform Registry
Name Description Type
application_failure_feedback_role_arn ARN of the IAM role for failure feedback. string
application_success_feedback_sample_rate Percentage of success to sample. num...
firehose_failure_feedback_role_arn ARN of the IAM role...
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
Agreed, that sounds like a good step forward until the underlying problem is resolved. Happy to open a PR for this. The underlying bug is already documented in the CloudFormation roadmap
So currently the API is broken, if a name is not passed- the queue creation will fail. And if a name is passed but does not have the
.fifo
suffix - the queue creation will fail.This is not a great customer experience and we should make it better, the minimum is to throw an error if
fifo
is set to true andqueueName
is not passed or missing the.fifo
. Build time errors are always better than deploy time error.The better experience will be to append the
fifo
suffix if a name is passed and to throw if a name is not passed.