-
Notifications
You must be signed in to change notification settings - Fork 711
Description
Confirm by changing [ ] to [x] below to ensure that it's a bug:
- I've gone though the API reference
- I've checked AWS Forums and StackOverflow for answers
- I've searched for previous similar issues and didn't find any solution
Describe the bug
When using a required custom resolver with apigatewaymanagmentapi service it appears that the stage is being dropped from the url used.
Version of AWS SDK for Go?
v1.2.1
Version of Go (go version
)?
1.15
To Reproduce (observed behavior)
We are using the following custom resolver
customResolver := aws.EndpointResolverFunc(func(service, region string) (aws.Endpoint, error) {
if service == apigatewaymanagementapi.ServiceID && region == "eu-west-1" {
return aws.Endpoint{
PartitionID: "aws",
URL: "https://xxxxxx.execute-api.eu-west-1.amazonaws.com/LATEST",
SigningRegion: "eu-west-1",
HostnameImmutable: true,
Source: aws.EndpointSourceCustom,
}, nil
}
return aws.Endpoint{}, fmt.Errorf("unknown endpoint requested")
})
cfg, err := config.LoadDefaultConfig(context.Background(), config.WithEndpointResolver(customResolver), config.WithClientLogMode(aws.LogRetries|aws.LogRequest))
And we are making the request like so:
_, err := wsc.client.GetConnection(ctx, &apigatewaymanagementapi.GetConnectionInput{
ConnectionId: aws.String("xxxxxxxxxx=x"),
})
See logs below
Expected behavior
We are expecting to get a successful response from the api.
Additional context
We are seeing the following error logs, it appears that the url no longer includes LATEST which is the name of our stage
SDK 2021/03/23 15:44:54 DEBUG Request
--
GET /@connections/cpV6NdyODoECInw%3D HTTP/1.1
Host: xxxxxxxx.execute-api.eu-west-1.amazonaws.com
User-Agent: aws-sdk-go-v2/1.2.1
Amz-Sdk-Invocation-Id: eacfb162-7c3c-4903-a210-e37c3ff632ba
Amz-Sdk-Request: attempt=1; max=3
Authorization: <REDACTED>
X-Amz-Date: 20210323T154454Z
X-Amz-Security-Token: <REDACTED>
X-Amz-User-Agent: aws-sdk-go-v2/1.2.1 os/linux lang/go/1.16.2 md/GOOS/linux md/GOARCH/amd64 exec-env/AWS_Lambda_go1.x
Accept-Encoding: gzip
SDK 2021/03/23 15:44:54 DEBUG request failed with unretryable error https response error StatusCode: 403, RequestID: 99ba811c-47ae-4c62-bece-9b3128218d5f, ForbiddenException:
The documentation here https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-how-to-call-websocket-api-connections.html clearly shows that the stage is a required element of the url. If we miss it out from cli usage we see the same error as above.
It looks this is a regression since v0.24, as our code using that version works fine.