Admiral-Piett / goaws

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

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

Open attilah opened 1 month ago

attilah commented 1 month 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 weeks 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)