aws / aws-sdk-go

AWS SDK for the Go programming language.

Home Page:http://aws.amazon.com/sdk-for-go/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't create SQS queue with docker localstack/localstack starting from v1.47.6

koschos opened this issue · comments

Describe the bug

I have this simple go code that creates SQS queue for me.

import "github.com/aws/aws-sdk-go/service/sqs"

// in app
sqsClient := sqs.New(awsSession)
_, err := sqsClient.CreateQueueWithContext(ctx, &sqs.CreateQueueInput{
		QueueName: &queueName,
})
if err != nil {
  return err
}

I'm using docker localstack for local testing.
After I upgraded aws-sdk-go to a version higher than v1.47.5 (starting from v1.47.6),
I can't create SQS queue. It fails with error.

SerializationError: failed to unmarshal response error
	status code: 500, request id: 
caused by: UnmarshalError: failed decoding error message

00000000  3c 3f 78 6d 6c 20 76 65  72 73 69 6f 6e 3d 27 31  |<?xml version='1|
00000010  2e 30 27 20 65 6e 63 6f  64 69 6e 67 3d 27 75 74  |.0' encoding='ut|
00000020  66 2d 38 27 3f 3e 0a 3c  45 72 72 6f 72 52 65 73  |f-8'?>.<ErrorRes|
00000030  70 6f 6e 73 65 20 78 6d  6c 6e 73 3d 22 68 74 74  |ponse xmlns="htt|
00000040  70 3a 2f 2f 71 75 65 75  65 2e 61 6d 61 7a 6f 6e  |p://queue.amazon|
00000050  61 77 73 2e 63 6f 6d 2f  64 6f 63 2f 32 30 31 32  |aws.com/doc/2012|
00000060  2d 31 31 2d 30 35 2f 22  3e 3c 45 72 72 6f 72 3e  |-11-05/"><Error>|
00000070  3c 43 6f 64 65 3e 49 6e  74 65 72 6e 61 6c 45 72  |<Code>InternalEr|
00000080  72 6f 72 3c 2f 43 6f 64  65 3e 3c 4d 65 73 73 61  |ror</Code><Messa|
00000090  67 65 3e 65 78 63 65 70  74 69 6f 6e 20 77 68 69  |ge>exception whi|
000000a0  6c 65 20 63 61 6c 6c 69  6e 67 20 73 71 73 20 77  |le calling sqs w|
000000b0  69 74 68 20 75 6e 6b 6e  6f 77 6e 20 6f 70 65 72  |ith unknown oper|
000000c0  61 74 69 6f 6e 3a 20 54  72 61 63 65 62 61 63 6b  |ation: Traceback|
000000d0  20 28 6d 6f 73 74 20 72  65 63 65 6e 74 20 63 61  | (most recent ca|
000000e0  6c 6c 20 6c 61 73 74 29  3a 0a 20 20 46 69 6c 65  |ll last):.  File|
000000f0  20 26 71 75 6f 74 3b 2f  6f 70 74 2f 63 6f 64 65  | &quot;/opt/code|
00000100  2f 6c 6f 63 61 6c 73 74  61 63 6b 2f 6c 6f 63 61  |/localstack/loca|
00000110  6c 73 74 61 63 6b 2f 61  77 73 2f 63 68 61 69 6e  |lstack/aws/chain|
00000120  2e 70 79 26 71 75 6f 74  3b 2c 20 6c 69 6e 65 20  |.py&quot;, line |
00000130  39 30 2c 20 69 6e 20 68  61 6e 64 6c 65 0a 20 20  |90, in handle.  |
00000140  20 20 68 61 6e 64 6c 65  72 28 73 65 6c 66 2c 20  |  handler(self, |
00000150  73 65 6c 66 2e 63 6f 6e  74 65 78 74 2c 20 72 65  |self.context, re|
00000160  73 70 6f 6e 73 65 29 0a  20 20 46 69 6c 65 20 26  |sponse).  File &|
00000170  71 75 6f 74 3b 2f 6f 70  74 2f 63 6f 64 65 2f 6c  |quot;/opt/code/l|
00000180  6f 63 61 6c 73 74 61 63  6b 2f 6c 6f 63 61 6c 73  |ocalstack/locals|
00000190  74 61 63 6b 2f 61 77 73  2f 68 61 6e 64 6c 65 72  |tack/aws/handler|
000001a0  73 2f 73 65 72 76 69 63  65 2e 70 79 26 71 75 6f  |s/service.py&quo|
000001b0  74 3b 2c 20 6c 69 6e 65  20 36 34 2c 20 69 6e 20  |t;, line 64, in |
000001c0  5f 5f 63 61 6c 6c 5f 5f  0a 20 20 20 20 72 65 74  |__call__.    ret|
000001d0  75 72 6e 20 73 65 6c 66  2e 70 61 72 73 65 5f 61  |urn self.parse_a|
000001e0  6e 64 5f 65 6e 72 69 63  68 28 63 6f 6e 74 65 78  |nd_enrich(contex|

In the localstack docker container I see this error log:

localstack.aws.protocol.parser.ProtocolParserError: Operation detection failed. Missing Action in request for query-protocol service ServiceModel(sqs).

Expected Behavior

aws-sdk-go is able to create SQS queue on localstack docker container

Current Behavior

aws-sdk-go fails with error when trying to create SQS queue on localstack docker container

Reproduction Steps

  1. Run localstack docker container (from v2.20 to latest)
  2. Run go script that creates SQS queue in this localstack instance.

Possible Solution

No response

Additional Information/Context

No response

SDK version used

v1.47.6

Environment details (Version of Go (go version)? OS name and version, etc.)

go 1.21.1

The SQS service just changed to using a JSON-based protocol (and thus so has our SDK client). I'm going to assume the localstack implementation of the API has not.

You'll either need to wait for localstack to make a JSON-compatible version of the API available or downgrade for the time being.

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.