I'm attempting to use localstack for development with SQS.
- Aws client v2.20.60
- localstack v2.0.2.
I'm following this blog post, but no matter what I try, I always get the error:
exception while calling sqs with unknown operation: Operation detection failed. Missing Action in request for query-protocol service ServiceModel(sqs).
This is how I created the SqsClient:
SqsClientBuilder builder = SqsClient.builder();
builder.credentialsProvider(StaticCredentialsProvider.create(AwsBasicCredentials.create("test", "test")));
builder.endpointOverride(new URI("http://localhost:4566"));
builder.region(Region.of("us-west-2"));
return builder.build();
And then any of the Sqs operations, for example creating a queue:
sqsClient.createQueue(CreateQueueRequest.builder()
.queueName("test2")
.build());
Logs:
software.amazon.awssdk.request : Retrying Request: DefaultSdkHttpFullRequest(httpMethod=POST, protocol=http, host=localhost, port=4566, encodedPath=/, headers=[amz-sdk-invocation-id, Content-Length, Content-Type, User-Agent, X-Amz-Target], queryParameters=[])
org.apache.http.wire : http-outgoing-3 >> "POST / HTTP/1.1[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "Host: localhost:4566[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "amz-sdk-invocation-id: 3f223a7a-773b-d41f-388a-b222efb26e25[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "amz-sdk-request: attempt=4; max=4[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "Authorization: AWS4-HMAC-SHA256 Credential=test/20230512/us-west-2/sqs/aws4_request, SignedHeaders=amz-sdk-invocation-id;amz-sdk-request;content-length;content-type;host;x-amz-date;x-amz-target, Signature=4cd498092415018e24f7fb37c3b86ad77f10154f3cc5dc2627f3e7bf2aa7b7f8[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "Content-Type: application/x-amz-json-1.0[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "User-Agent: aws-sdk-java/2.20.60 Linux/6.3.1 OpenJDK_64-Bit_Server_VM/17.0.3+7-nixos Java/17.0.3 vendor/N_A io/sync http/Apache cfg/retry-mode/legacy[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "X-Amz-Date: 20230512T043918Z[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "X-Amz-Target: AmazonSQS.CreateQueue[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "Content-Length: 21[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "Connection: Keep-Alive[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "[\r][\n]"
org.apache.http.wire : http-outgoing-3 >> "{"QueueName":"test2"}"
org.apache.http.wire : http-outgoing-3 << "HTTP/1.1 500 [\r][\n]"
org.apache.http.wire : http-outgoing-3 << "Content-Type: text/xml[\r][\n]"
org.apache.http.wire : http-outgoing-3 << "Content-Length: 407[\r][\n]"
org.apache.http.wire : http-outgoing-3 << "Access-Control-Allow-Origin: *[\r][\n]"
org.apache.http.wire : http-outgoing-3 << "Access-Control-Allow-Methods: HEAD,GET,PUT,POST,DELETE,OPTIONS,PATCH[\r][\n]"
org.apache.http.wire : http-outgoing-3 << "Access-Control-Allow-Headers: authorization,cache-control,content-length,content-md5,content-type,etag,location,x-amz-acl,x-amz-content-sha256,x-amz-date,x-amz-request-id,x-amz-security-token,x-amz-tagging,x-amz-target,x-amz-user-agent,x-amz-version-id,x-amzn-requestid,x-localstack-target,amz-sdk-invocation-id,amz-sdk-request[\r][\n]"
org.apache.http.wire : http-outgoing-3 << "Access-Control-Expose-Headers: etag,x-amz-version-id[\r][\n]"
org.apache.http.wire : http-outgoing-3 << "date: Fri, 12 May 2023 04:39:18 GMT[\r][\n]"
org.apache.http.wire : http-outgoing-3 << "server: hypercorn-h11[\r][\n]"
org.apache.http.wire : http-outgoing-3 << "[\r][\n]"
software.amazon.awssdk.request : Received failed response: 500, Request ID: not available, Extended Request ID: not available
org.apache.http.wire : http-outgoing-3 << "<?xml version='1.0' encoding='utf-8'?>[\n]"
org.apache.http.wire : http-outgoing-3 << "<ErrorResponse xmlns="http://queue.amazonaws.com/doc/2012-11-05/"><Error><Code>InternalError</Code><Message>exception while calling sqs with unknown operation: Operation detection failed. Missing Action in request for query-protocol service ServiceModel(sqs).</Message></Error><RequestId>5J3R58QQJ04NODX9NQYFLEZM110VTGAFIQ0W894F7HXWVNAZCK3U</RequestId></ErrorResponse>"
o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed: software.amazon.awssdk.services.sqs.model.SqsException: Service returned HTTP status code 500 (Service: Sqs, Status Code: 500, Request ID: null)] with root cause
software.amazon.awssdk.services.sqs.model.SqsException: Service returned HTTP status code 500 (Service: Sqs, Status Code: 500, Request ID: null)
at software.amazon.awssdk.core.internal.http.CombinedResponseHandler.handleErrorResponse(CombinedResponseHandler.java:125)
at ...
org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:833)