Description
Describe the bug
Connecting docker sqs with the below endpoint resolver throwing GetQueueUrl, https response error StatusCode: 400, RequestID: , deserialization failed, failed to decode response body, invalid character '<' looking for beginning of value
docker run-cmd:
docker run -p 9324:9324 -p 9325:9325 -v
pwd/custom.conf:/opt/elasticmq.conf softwaremill/elasticmq
My Test code:
package main
import (
"context"
"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/sqs"
"log"
)
func main() {
getQUrl()
}
func getQUrl() {
ctx := context.Background()
qName := "input-queue"
endpointOverride := "http://localhost:9324"
region := "us-east-1"
cfg, err := newConfig(endpointOverride, region)
if err != nil {
log.Panicln("error in sqs client creation", err)
}
client := sqs.NewFromConfig(*cfg)
output, err := client.GetQueueUrl(ctx, &sqs.GetQueueUrlInput{QueueName: &qName})
if err != nil || output.QueueUrl == nil {
log.Panicf("unable to get url for the queue: %s. %v", qName, err)
}
}
func newConfig(endpoint, region string) (*aws.Config, error) {
cfg, err := config.LoadDefaultConfig(
context.TODO(),
config.WithRegion(region),
config.WithEndpointResolverWithOptions(aws.EndpointResolverWithOptionsFunc(
func(service, region string, options ...interface{}) (aws.Endpoint, error) {
if (service == sqs.ServiceID) && len(endpoint) > 0 {
return aws.Endpoint{URL: endpoint, SigningRegion: region}, nil
}
return aws.Endpoint{}, &aws.EndpointNotFoundError{}
},
)),
)
return &cfg, err
}
Expected Behavior
It has to connect to the docker and get the queue url.
Current Behavior
Its throws error GetQueueUrl, https response error StatusCode: 400, RequestID: , deserialization failed, failed to decode response body, invalid character '<' looking for beginning of value
Its not only for GetQueueUrl even if I give the queue url and invoke sendMessage I get the same error for SendMessage call
Reproduction Steps
test code is given in the description
Possible Solution
No response
Additional Information/Context
The test code in the description section is able to connect to the AWS environment without issues., is there any issue with the EndpointResolverWithOptions?
AWS Go SDK V2 Module Versions Used
go 1.21.5
require (
github.com/aws/aws-sdk-go-v2 v1.24.1
github.com/aws/aws-sdk-go-v2/config v1.26.3
github.com/aws/aws-sdk-go-v2/service/sqs v1.29.7
)
require (
github.com/aws/aws-sdk-go-v2/credentials v1.16.14 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.2.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.5.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.10.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.10.10 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.18.6 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.6 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.26.7 // indirect
github.com/aws/smithy-go v1.19.0 // indirect
)
Compiler and Version used
go1.21.5 windows/amd64
Operating System and version
Windows 11
Activity