Skip to content

Commit a9d3b02

Browse files
authored
fix(sqs): queue with fifo: false does not deploy (#31922)
The `FifoQueue` property in CloudFormation can only be `true`, or must be absent. If you pass `FifoQueue: false`, you will receive the following error: ``` Resource handler returned message: "Unknown Attribute FifoQueue. (Service: Sqs, Status Code: 400, Request ID: e27d9d99-fe35-5b36-b670-c200419bc975)" (RequestToken: 1d882ab3-52e8-7e4b-e2d3-58e6ba10141d, HandlerErrorCode: InvalidRequest) ``` Make it so that a `fifo: false` configuration doesn't output FifoQueue at all. Closes #8550. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 186b8ab commit a9d3b02

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

packages/aws-cdk-lib/aws-sqs/lib/queue.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,11 @@ export class Queue extends QueueBase {
560560
contentBasedDeduplication: props.contentBasedDeduplication,
561561
deduplicationScope: props.deduplicationScope,
562562
fifoThroughputLimit: props.fifoThroughputLimit,
563-
fifoQueue,
563+
564+
// This value will be passed directly into the L1 props, but the underlying `AWS::SQS::Queue`
565+
// does not accept `FifoQueue: false`. It must either be `true` or absent. So change a `false` into
566+
// an `undefined`.
567+
fifoQueue: fifoQueue ? true : undefined,
564568
};
565569
}
566570

packages/aws-cdk-lib/aws-sqs/test/sqs.test.ts

+22
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,28 @@ test('test a queue throws when deduplicationScope specified on non fifo queue',
675675
}).toThrow();
676676
});
677677

678+
test('fifo: false is dropped from properties', () => {
679+
// GIVEN
680+
const stack = new Stack();
681+
682+
// WHEN
683+
new sqs.Queue(stack, 'Queue', {
684+
fifo: false,
685+
});
686+
687+
// THEN
688+
Template.fromStack(stack).templateMatches({
689+
'Resources': {
690+
'Queue4A7E3555': {
691+
'Type': 'AWS::SQS::Queue',
692+
'Properties': Match.absent(),
693+
'UpdateReplacePolicy': 'Delete',
694+
'DeletionPolicy': 'Delete',
695+
},
696+
},
697+
});
698+
});
699+
678700
test('test metrics', () => {
679701
// GIVEN
680702
const stack = new Stack();

0 commit comments

Comments
 (0)