Aws-sdk-java: Getting "The specified queue does not exist for this wsdl version" on AmazonSQS.getQueueName

Created on 29 Apr 2019  路  9Comments  路  Source: aws/aws-sdk-java

I get the message "The specified queue does not exist for this wsdl version." from AmaonSQS.getQueueUrl for a valid queue,credential and region The queue IS present and when I make the get-queue-url call via AWS CLI using the same credentials, region and queue name, I DO get the queue back. Using latest version of 1.11. Any recommendations on how to fix this?

guidance

Most helpful comment

I think this issue should be re-opened. It exists across SDK's. The fact that the region needs to be specified when the region is in the URL is a failing of the SDK and in addition the error message is not helpful

All 9 comments

Hi @lcfarrington92, this error usually means the specified queue does not exist on the specified region, it may be due to an incorrect queue name or client configuration.

Could you share a code snippet showing how you're creating the SQS client?

I don't believe the region is the problem as I called this with same region via CLI and I get the arn back, so maybe a config issue? Here's a code snippet. Not sure how much to include, let me know if you need to see more than I have here:
AmazonSQS sqs = AmazonSQSClientBuilder.standard()
.withRegion(region)
.withCredentials(credentialsProvider)
.withClientConfiguration(new ClientConfiguration()
.withMaxConnections(10))
.build();

The client seems good. If you turn wire logging on, you can get additional information about the request, and you can check if the region and queue name are correct.

If you choose to provide us the logs, please make sure there is no sensitive data.

It looks like it is the wrong region(eu-west-2 instead of us-west-2) but unsure as to why. Here's a snippet from the log:
05-01 09:38:27 DEBUG o.a.h.wire - http-outgoing-1 >> "POST / HTTP/1.1[\r][\n]"
05-01 09:38:27 DEBUG o.a.h.wire - http-outgoing-1 >> "Host: sqs.eu-west-1.amazonaws.com[\r][\n]"
However, in the debugger, if I put a breakpoint on .withRegion, I can see that it is correctly set to us-west2.
AmazonSQS sqs = AmazonSQSClientBuilder.standard()
.withRegion(region)
.withCredentials(credentialsProvider)
.withClientConfiguration(new ClientConfiguration()
.withMaxConnections(10))
.build();
String queueUrl = sqs.getQueueUrl(queueName).getQueueUrl();

It seems like the eu-west-1 region is being set somewhere in your environment. Check this AWS Region Selection guide, it might help you figure out where:
https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/java-dg-region-selection.html

I'll go ahead and close this since it doesn't look like an issue with the SDK itself. Please feel free to reopen if you have further questions.

I think this issue should be re-opened. It exists across SDK's. The fact that the region needs to be specified when the region is in the URL is a failing of the SDK and in addition the error message is not helpful

In my case I am specifying the region, and I still get this - but not all the time. I get it periodically. It rears its ugly head, and then disappears again without any changes at all occurring on my side at all. This smells of an AWS issue.

I was seeing this error as well but when I went to reproduce it, I realized that I was not injecting my credentials appropriately and was instead picking up other credentials from the default provider chain. So the error was more that there was not a queue in that particular user account from the account that account that actually created the queue.

Hi @lcfarrington92, this error usually means the specified queue does not exist on the specified region, it may be due to an incorrect queue name or client configuration.

Could you share a code snippet showing how you're creating the SQS client?

Exactly what happened to me. I was referencing another region.

Was this page helpful?
0 / 5 - 0 ratings