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

(SQS): Unable to import a FIFO queue when the queue ARN is a Token #12466

Closed
gibsonan opened this issue Jan 12, 2021 · 2 comments · Fixed by #15976
Closed

(SQS): Unable to import a FIFO queue when the queue ARN is a Token #12466

gibsonan opened this issue Jan 12, 2021 · 2 comments · Fixed by #15976
Labels
@aws-cdk/aws-sqs Related to Amazon Simple Queue Service bug This issue is a bug. effort/small Small work item – less than a day of effort p1

Comments

@gibsonan
Copy link

gibsonan commented Jan 12, 2021

Unable to use fromQueueArn or fromQueueAttributes to import an existing queue with the fifo property set to True when the queue ARN is a Token.

Reproduction Steps

queue_arn = core.Fn.import_value(shared_value_to_import=EXISTING_FIFO_QUEUE_ARN_EXPORT_NAME)

# CDK assumes it's a standard queue and there is no option to override
fifo_queue = aws_cdk.aws_sqs.Queue.from_queue_arn(self, 'SharedFifoQueue', queue_arn)
assert fifo_queue.fifo  # Fails assert

# Explicitly specifying the queue url with the `.fifo` suffix doesn't help
fifo_queue = aws_cdk.aws_sqs.Queue.from_queue_attributes(
    self, 'SharedFifoQueue',
    queue_arn=queue_arn,  # Required argument
    queue_url='https://sqs.us-west-2.amazonaws.com/123456789012/ExistingFifoQueue.fifo'
)
assert fifo_queue.fifo  # Fails assert

What did you expect to happen?

CDK either automatically resolves that the queue is FIFO, deduces that it's FIFO from the URL, or provides a mechanism for manually setting the fifo property to True.

What actually happened?

CDK imported the FIFO SQS queue with the fifo property set to False

Environment

  • CDK CLI Version : 1.83.0
  • Framework Version: 1.83.0
  • Node.js Version: 15.5.1
  • OS : MacOS v11.1
  • Language (Version): Python 3.8.6

Other

This matters because it's not possible to synthesize this EventBridge Rule. CDK rejects the message_group_id parameter since fifo_queue.fifo is False.

aws_cdk.aws_events.Rule(
    self, 'EventsToFifoQueue',
    targets=[
        aws_cdk.aws_events_targets.SqsQueue(
            queue=fifo_queue,
            message_group_id='default',  
        )
    ],
    event_pattern=aws_cdk.aws_events.EventPattern(detail_type=['Foo Event'])
)

This is 🐛 Bug Report

@gibsonan gibsonan added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 12, 2021
@github-actions github-actions bot added the @aws-cdk/aws-sqs Related to Amazon Simple Queue Service label Jan 12, 2021
@MrArnoldPalmer MrArnoldPalmer added effort/small Small work item – less than a day of effort p1 and removed needs-triage This issue or PR still needs to be triaged. labels Feb 22, 2021
@rubfergor
Copy link

Is there any advance on this? If trying to import a SQS FIFO queue using its ARN from another stack, you can't use the queue as an EventBridge target with a messageId on Typescript neither.

@MrArnoldPalmer MrArnoldPalmer removed their assignment Jun 21, 2021
@mergify mergify bot closed this as completed in #15976 Aug 24, 2021
mergify bot pushed a commit that referenced this issue Aug 24, 2021
…#15976)

The fifo property of a SQS queue is determined based on the queue name. The suffix `.fifo` indicates that it is a fifo queue.
When the queue is imported from a token, the name is not known on synthesis time. Therefore, the name of the queue can't be used to initialize the queue as a FIFO queue.

In some constructs, CDK checks during synthesis if the given queue is a FIFIO queue. Because of that, an additional option is necessary to specify a FIFO queue. 

A new boolean property `fifo` is introduced which can be used to specify a FIFO queue that is imported from a token. The property is optional and is only necessary when a FIFO queue should be imported from a token.

Closes #12466.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

hollanddd pushed a commit to hollanddd/aws-cdk that referenced this issue Aug 26, 2021
…aws#15976)

The fifo property of a SQS queue is determined based on the queue name. The suffix `.fifo` indicates that it is a fifo queue.
When the queue is imported from a token, the name is not known on synthesis time. Therefore, the name of the queue can't be used to initialize the queue as a FIFO queue.

In some constructs, CDK checks during synthesis if the given queue is a FIFIO queue. Because of that, an additional option is necessary to specify a FIFO queue. 

A new boolean property `fifo` is introduced which can be used to specify a FIFO queue that is imported from a token. The property is optional and is only necessary when a FIFO queue should be imported from a token.

Closes aws#12466.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Sep 6, 2021
…aws#15976)

The fifo property of a SQS queue is determined based on the queue name. The suffix `.fifo` indicates that it is a fifo queue.
When the queue is imported from a token, the name is not known on synthesis time. Therefore, the name of the queue can't be used to initialize the queue as a FIFO queue.

In some constructs, CDK checks during synthesis if the given queue is a FIFIO queue. Because of that, an additional option is necessary to specify a FIFO queue. 

A new boolean property `fifo` is introduced which can be used to specify a FIFO queue that is imported from a token. The property is optional and is only necessary when a FIFO queue should be imported from a token.

Closes aws#12466.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
david-doyle-as24 pushed a commit to david-doyle-as24/aws-cdk that referenced this issue Sep 7, 2021
…aws#15976)

The fifo property of a SQS queue is determined based on the queue name. The suffix `.fifo` indicates that it is a fifo queue.
When the queue is imported from a token, the name is not known on synthesis time. Therefore, the name of the queue can't be used to initialize the queue as a FIFO queue.

In some constructs, CDK checks during synthesis if the given queue is a FIFIO queue. Because of that, an additional option is necessary to specify a FIFO queue. 

A new boolean property `fifo` is introduced which can be used to specify a FIFO queue that is imported from a token. The property is optional and is only necessary when a FIFO queue should be imported from a token.

Closes aws#12466.

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-sqs Related to Amazon Simple Queue Service bug This issue is a bug. effort/small Small work item – less than a day of effort p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants