aws-cdk icon indicating copy to clipboard operation
aws-cdk copied to clipboard

SQS - Unknown Attribute FifoQueue when setting fifo to false in Queue Props

Open HassanMahmud opened this issue 6 years ago • 22 comments

Setting fifo to false in QueueProps when creating an SQS queue causes the deploy to fail.

Reproduction Steps

This is the code used to create the queue. It is part of a reusable component, I have made a workaround of only setting the fifo prop if it is set to true and everything works as expected.

return new sqs.Queue(stack, name, {
      encryption: encrypted ? sqs.QueueEncryption.KMS_MANAGED : sqs.QueueEncryption.UNENCRYPTED,
      fifo,
      queueName: name,
      retentionPeriod,
      visibilityTimeout
    });

Error Log

This error shows up under CloudFormation events as the reason why creating the queue failed. Unknown Attribute FifoQueue. (Service: AmazonSQS; Status Code: 400; Error Code: InvalidAttributeName; Request ID: <REQUEST_ID>)

Environment

  • CLI Version : 1.45.0
  • Framework Version: 1.45.0
  • Node.js Version: v14.3.0
  • OS : macOS Catalina v10.15.15
  • Language (Version): TypeScript (^3.9.5)

Other

I found a similar issue report here: AWS PHP SDK Github issue


This is :bug: Bug Report

HassanMahmud avatar Jun 15 '20 13:06 HassanMahmud

Hey there. Looks like this is a known issue with cloudformation. They have an issue in their roadmap for it.

We can potentially perform some logic inside of the construct to pass undefined to the L1 when the user passes false to cover this from our side. I can't imagine that causing any conflicts in the future. @eladb opinions on diverging from CFN here to prevent this error? Should be non-breaking as far as I can tell.

That is exactly what you're workaround is doing but one level higher. Anyone else encountering this can do that as well in the meantime.

MrArnoldPalmer avatar Jun 17 '20 22:06 MrArnoldPalmer

I've just bumped into this issue as well.

It would make a lot of sense to reflect this in the docs. Currently docs for interface QueueProps reads: fifo? | boolean. Would be better to make it some enum like true or undefined.

suankan avatar Oct 04 '20 14:10 suankan

experience same

bitsofinfo avatar Dec 08 '20 04:12 bitsofinfo

bump - also ran into this issue

emekdahl avatar Feb 19 '21 15:02 emekdahl

bump - same issue, in python 3.7 using:

 self._queue=sqs.Queue(
            scope, 
            QUEUE_ID_PREFIX + name, 
            fifo=True if FIFO_ENABLED else None,
            removal_policy=REMOVAL_POLICY
        )

fixed this for me.

ParallelPlatypus avatar Feb 24 '21 01:02 ParallelPlatypus

same, Python 3.9

JordanRickman avatar Mar 22 '21 19:03 JordanRickman

Had the same issue, python 3.9, still unclear that it needs None

eskobarba avatar Sep 23 '21 13:09 eskobarba

Seeing this as well in typescript.

noam-alchemy avatar Nov 03 '21 03:11 noam-alchemy

Seeing this as well. The documentation is literally incorrect in claiming that FifoQueue is boolean.

emmavray avatar Dec 22 '21 19:12 emmavray

Same issue when contentBasedDeduplication=false.

jmurzy avatar Feb 08 '22 22:02 jmurzy

Just encountered this in CDK v2 using Typescript. Agree with comments elsewhere in the thread - update docs and/or make this an enum of true | undefined. Minor issue but easily fixed.

wilhen01 avatar Jun 22 '22 17:06 wilhen01

Also ran into this in CDK v2 Typescript. Not exactly the same issue since my FifoQueue is currently always false, but I just removed the property altogether and it solved my issue.

gwin003 avatar Aug 01 '22 17:08 gwin003

Hello. Saw the same issue here and yeah removing the property helps, but still confusing

JussiLem avatar Nov 25 '22 11:11 JussiLem

This issue has received a significant amount of attention so we are automatically upgrading its priority. A member of the community will see the re-prioritization and provide an update on the issue.

github-actions[bot] avatar Apr 02 '23 00:04 github-actions[bot]

It appears this issue has moved to Coming Soon on the CloudFormation roadmap. We should continue to wait for CloudFormation to push this as it appears the wait will not be much longer

peterwoodworth avatar Apr 18 '23 22:04 peterwoodworth

Workaround in Typescript CDK

const additionalProperties = props.fifo
            ? {
                  fifo: true,
              }
            : {};

queue = new aws_sqs.Queue(this, `SomeQueue`, {
            queueName: name,
            ...additionalProperties
})

cyber-gh avatar Aug 10 '23 13:08 cyber-gh

Any movement on this?

mappingvermont avatar Jan 12 '24 15:01 mappingvermont

Bump, same issue. Fixed using @ParallelPlatypus's method (thank you!) fifo=True if fifo_enabled==True else None

matt-challe avatar Apr 09 '24 22:04 matt-challe

Bump, had to remove the property fifo as it was set to false. Can we get an ETA when this is resolved in CDK?

lennard0011 avatar May 24 '24 12:05 lennard0011

This is still an issue.

imo it should not accept undefined at all, but I guess now that people are required to use it it should be marked as deprecated and only accept true/false after few versions.

I've just bumped into this issue as well.

It would make a lot of sense to reflect this in the docs. Currently docs for interface QueueProps reads: fifo? | boolean. Would be better to make it some enum like true or undefined.

or even better: make it work like other constructs by allowing only boolean values and adjust documentation accordingly.

in the meantime I added function that i can call to hide the inconsistency.

function fixCDKBooleanLogic(isValueTrue: boolean): boolean | undefined { if (isValueTrue) { return true; } else { return undefined; } }

and calling it from sqs construct, where props.fifotype is boolean value. new sqs.Queue(this, fine-sqs-queue, { fifo: fixCDKBooleanLogic(props.fifotype), ... }

oappicgi avatar Jul 04 '24 13:07 oappicgi