Admiral-Piett / goaws

AWS (SQS/SNS) Clone for Development testing
MIT License
767 stars 144 forks source link

"Bad Request - Action: " with GoLang github.com/aws/aws-sdk-go-v2/service/sqs v1.28.0 #281

Closed keithMqG closed 5 months ago

keithMqG commented 7 months ago

Attempting to use GetQueueUrl with GoLang github.com/aws/aws-sdk-go-v2/service/sqs v1.28.0 causes Bad Request.

Works fine with v1.24.7.

Needs further investigation.

gitaugakwa commented 7 months ago

Getting the same with a local build from 42f5c2de159de2ffc8b69ed42908d2acbd529a83 commit.

Using both the postman collection and the was cli

gitaugakwa commented 7 months ago

My bad, I wasn't sending the appropriate body using the collection.

Works with the postman but the cli doesn't work with a command like aws --endpoint-url http://localhost:4100 --profile Profile --region eu-west-1 sqs list-queues

Env: aws-cli/2.13.38 Python/3.11.6 Windows/10 exe/AMD64 prompt/off

jrhy commented 7 months ago

I see a similar response after upgrading from github.com/aws/aws-sdk-go from v1.45.28 to v1.48.6. It could be because the SDK request format has changed, and no longer uses Content-Type: application/x-www-form-urlencoded, but Content-Type: application/x-amz-json-1.0, like:

POST / HTTP/1.1
Host: 127.0.0.1:9324
Accept-Encoding: zstd,gzip
Content-Type: application/x-amz-json-1.0
X-Amz-Date: 20231128T222049Z
X-Amz-Target: AmazonSQS.GetQueueUrl

{"QueueName":"myqueue"}
jrhy commented 7 months ago

The AWS SDK for Go began supporting JSON requests for SQS in v1.47.7, and AWS SDK for Go v2 in v1.28.0, according to https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/sqs-json-faqs.html .

iamed2 commented 5 months ago

AWS changed the service definition in-place for SQS without a version change, switching it from Query to JSON. Most SDKs will not be set up to handle both versions; either they are custom-written (rare) and will continue using the Query protocol, or they are auto-generated and will switch to the JSON protocol when regenerated from recent specs. I haven't yet seen an SDK that supports the JSON protocol for SQS but allows forcing the Query protocol.

Likely there is a significant portion of users in both camps right now.

Admiral-Piett commented 5 months ago

I think this is a duplicate of https://github.com/Admiral-Piett/goaws/issues/279 we are working on implementing JSON processing as quickly as we can. Though the work is significant, and I only have so much time. 🙂

There's a feature branch in that issue with the work in progress if anyone would like to track and/or contribute.

Closing as a duplicate.