-
Notifications
You must be signed in to change notification settings - Fork 1.2k
QueueUrls plugin incorrectly inferring region from custom URL #2696
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
Comments
Thanks for opening an issue. I've looked at this code recently and can agree that it's fragile. I think a workaround might be to create an SQS client using your custom |
We currently parse the region like this:
Another workaround might be to rename your queue url to avoid this limitation - perhaps removing "sqs" from "localstack-sqs"? or rename to "sqs-localstack" |
Hi @mullermp. Thanks for the quick reply! I think if possible we would prefer not to have to change the name of the local service Regarding your first workaround suggestion about setting an [16] > sqs_client.config.endpoint.to_s
=> "https://localstack-sqs.example.dev" I am not 100% sure what you mean by "not passing the queue url" though. The |
|
I've pushed a fix to handle this. See #2697. |
@mullermp thank you! much appreciated 👍 |
Describe the bug
We have a custom localstack endpoint for our SQS service "localstack-sqs" and the queue names look like this:
https://localstack-sqs.example.dev/queue/example_queue_name
. When the QueueUrls plugin runsupdate_region
on that URL, it incorrectly ends up overriding theregion
toexample
.Expected Behavior
I think the expected behaviour should be that if
sqs
isn't a clear delimiter within the URL and is just part of the subdomain (localstack-sqs
in this example), then it shouldn't assume that the region is right aftersqs.
. It should instead skip updating the region altogether.Current Behavior
We discovered this because
was coming back with
even though
sqs_client.list_queues
is successfully listing the queues correctly.It turns out that when
queue_url
is specified, theQueueUrls::Handler#update_region
method will override the region with the section of the URL that comes immediately aftersqs.
which in our case wasn't a region, but instead was the domain.Reproduction Steps
Prints the following:
Possible Solution
Maybe we can ensure that we only assume the region is after sqs if sqs is either the 1st/2nd component of the URL (vpce-x-y.sqs.us-east-1.vpce.amazonaws.com or sqs.us-east-1.vpce.amazonaws.com)
Happy to open a PR for it if this sounds like a good idea and am also open to other ways of addressing it.
Additional Information/Context
Related PRs:
Related issues:
Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version
aws-sdk-sqs
Environment details (Version of Ruby, OS environment)
ruby 2.7.4
The text was updated successfully, but these errors were encountered: