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 purge_queue action gives improper error when crossing regions #3959

Closed
mhayden7 opened this issue Nov 29, 2023 · 2 comments
Closed

SQS purge_queue action gives improper error when crossing regions #3959

mhayden7 opened this issue Nov 29, 2023 · 2 comments
Labels
bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged.

Comments

@mhayden7
Copy link

Describe the bug

When attempting to purge queues in multiple regions that have the same names, boto3 thinks they are the same queue and returns an error even though the URL is different.

Expected Behavior

Purge should be triggered on queues in both regions instead of returning an error.

Current Behavior

print statements and exception:
purging https://sqs.us-east-1.amazonaws.com/*******/pennies
purging https://sqs.us-east-1.amazonaws.com/*******/nickels
purging https://sqs.us-east-1.amazonaws.com/*******/dimes
purging https://sqs.us-east-1.amazonaws.com/*******/quarters
purging https://sqs.us-west-2.amazonaws.com/*******/pennies
An error occurred (AWS.SimpleQueueService.PurgeQueueInProgress) when calling the PurgeQueue operation: Only one PurgeQueue operation on pennies is allowed every 60 seconds.

Reproduction Steps

Create queues in two regions with names 'pennies', 'nickels', 'dimes', and 'quarters'. Code that gets the exception:

if args.purge:
    sqs = boto3.client('sqs')
    try:
        for region in ['us-east-1', 'us-west-2']:
            for coin in ['pennies', 'nickels', 'dimes', 'quarters']:
                url = f"https://sqs.{region}.amazonaws.com/*******/{coin}"
                print(f"purging {url}")
                sqs.purge_queue(QueueUrl=url)
            time.sleep(60) # workaround for bug
    except Exception as e:
        print(e)

Possible Solution

Have boto3 internals check the entire QueueUrl parameter instead of just the name at the end.

Additional Information/Context

No response

SDK version used

1.33.2

Environment details (OS name and version, etc.)

Manjaro

@mhayden7 mhayden7 added bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged. labels Nov 29, 2023
@mhayden7
Copy link
Author

mhayden7 commented Nov 29, 2023

Update: well, nevermind, you can close this bug. It seems that boto is ignoring the 'url' and just invoking the queue by name. Here is resolved code:

if args.purge:
    try:
        for region in ['us-east-1', 'us-west-2']:
            sqs = boto3.client('sqs', region_name=region)
            for coin in ['pennies', 'nickels', 'dimes', 'quarters']:
                url = f"https://sqs.{region}.amazonaws.com/*******/{coin}"
                print(f"purging {url}")
                sqs.purge_queue(QueueUrl=url)
    except Exception as e:
        print(e)

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
bug This issue is a confirmed bug. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant