Admiral-Piett / goaws

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

Bad Request returned for SQS operations when using the .NET SDK #318

Closed attilah closed 1 month ago

attilah commented 3 months ago

We tried to use the tool with AWS .NET SDK and we received Bad Request response.

Sample code:

using Amazon.Runtime;
using Amazon.SQS;

var service = "http://localhost:4566/";
var credentials = new BasicAWSCredentials("dummy", "dummyKey");
var sqsClient = new AmazonSQSClient(credentials, new AmazonSQSConfig { ServiceURL = service});

try
{
    var response = await sqsClient.CreateQueueAsync($"foobar-0-{Guid.NewGuid()}");

    Console.WriteLine(response.QueueUrl);
}
catch (AmazonSQSException ex)
{
    Console.WriteLine(ex);
}

A discrepancy that I saw that when tried to create the same queue with AWS CLI it worked, but the returned queue url is invalid as a Url:

{
  "QueueUrl": "http://://foobar-0"
}

While with localstack it is more lifelike:

{
  "QueueUrl": "http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/foobar-1"
}
sofiagvaladze commented 3 months ago

Same here with ruby, seems to be broken since: https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-core/CHANGELOG.md#31920-2024-04-16 (didn't check minor versions but 3.191 works fine)

Admiral-Piett commented 2 months ago

@attilah Can you try it with v0.5.0? It's likely these issues are do to an SDK'S upgrade to AWS JSON 1.1 protocol, which we should support as of v0.5.0.

attilah commented 2 months ago

@Admiral-Piett sure, we're giving it a try, thanks!

attilah commented 2 months ago

It seems to be working with AWS CLI and the .NET SDK as well, thank you!