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 create_queue returns Queue not dictionary #3929

Closed
mdavis-xyz opened this issue Nov 11, 2023 · 5 comments
Closed

sqs create_queue returns Queue not dictionary #3929

mdavis-xyz opened this issue Nov 11, 2023 · 5 comments
Assignees
Labels
documentation This is a problem with documentation. response-requested Waiting on additional information or feedback. sqs

Comments

@mdavis-xyz
Copy link
Contributor

mdavis-xyz commented Nov 11, 2023

Describe the issue

Steps to reproduce

import boto3

client = boto3.resource('sqs')
response = client.create_queue(
    QueueName='myqueuetest.fifo',
    Attributes={
        'FifoQueue': 'true'
    },
)
queue_url = response['QueueUrl']
assert isinstance(queue_url, str)
queue = client.Queue(queue_url)

Expected behavior

  • assertions pass
  • create_queue returns a dictionary: {'QueueUrl': 'https://...'}

actual behavior

  • assertion fails
  • create_queue returns an sqs.Queue object

Commentary

Returning a sqs.Queue object is more convenient than returning a dictionary.

But the documentation should reflect this. Currently it says the function returns a dictionary.

Links

https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs/client/create_queue.html

Return type: dict

@mdavis-xyz mdavis-xyz added documentation This is a problem with documentation. needs-triage This issue or PR still needs to be triaged. labels Nov 11, 2023
@etienne-lebrun
Copy link

from what I understand, by calling `boto3.resource('sqs'), you're getting this api: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sqs/service-resource/create_queue.html#SQS.ServiceResource.create_queue

And the doc you're linking corresponds to the client you would get by calling boto3.client('sqs')

@vedimuthan
Copy link

It is indeed an issue, looks like botocore version 1.31.81 is broke which was released on Nov 8,2023. I hard coded boto version to 1.28.80 and botocore version to 1.31.80 and it worked fine.

image

@tim-finnigan tim-finnigan self-assigned this Nov 13, 2023
@tim-finnigan
Copy link
Contributor

@mdavis-xyz as mentioned in #3929 (comment) it does appear that you're using the create_queue resource command which does document that a Queue object is returned.

@vedimuthan can you share your QueueUrl format and debug logs for further review? (You can get those by adding boto3.set_stream_logger('') to your script - please redact any sensitive info). There were some recent SQS changes in botocore but I'm not sure if that could have impacted your code.

@tim-finnigan tim-finnigan added response-requested Waiting on additional information or feedback. sqs and removed needs-triage This issue or PR still needs to be triaged. labels Nov 13, 2023
@mdavis-xyz
Copy link
Contributor Author

Ah wow. Yep I was being stupid. I created a service resource but then assigned it to a variable named client. So I thought I was calling the client's API not the service one. My bad

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This is a problem with documentation. response-requested Waiting on additional information or feedback. sqs
Projects
None yet
Development

No branches or pull requests

4 participants