aws / aws-sdk-go-v2

AWS SDK for the Go programming language.
https://aws.github.io/aws-sdk-go-v2/docs/
Apache License 2.0
2.64k stars 638 forks source link

Timestream Query returns 404 due to incorrect host #1188

Closed kochie closed 2 years ago

kochie commented 3 years ago

Confirm by changing [ ] to [x] below to ensure that it's a bug:

Describe the bug When using the query methods in the timestreamquery library the client returns a 404 specifying

operation error Timestream Query: Query, https response error StatusCode: 404, RequestID: 693ffad7-e68c-4cdb-a861-a5412f4ee88d, api error UnknownOperationException: UnknownError

The http request is as follows

POST / HTTP/1.1
Host: query.timestream.us-east-1.amazonaws.com
User-Agent: aws-sdk-go-v2/1.3.0
Content-Length: 2
Amz-Sdk-Invocation-Id: 5154410c-ab6f-4c44-8273-0af8394775db
Amz-Sdk-Request: attempt=1; max=3
Content-Type: application/x-amz-json-1.0
X-Amz-Date: 20210319T110213Z
X-Amz-Target: Timestream_20181101.DescribeEndpoints
X-Amz-User-Agent: aws-sdk-go-v2/1.3.0 os/other lang/go/1.15.8 md/GOOS/darwin md/GOARCH/amd64
Accept-Encoding: gzip

However when I log the v1 sdk and complete a query I have no problems. The sdk performs the request to query-cell2.timestream.us-east-1.amazonaws.com

Host: query-cell2.timestream.us-east-1.amazonaws.com
User-Agent: aws-sdk-go/1.38.0 (go1.15.8; darwin; amd64)
Content-Length: 469
Content-Type: application/x-amz-json-1.0
X-Amz-Date: 20210319T110814Z
X-Amz-Target: Timestream_20181101.Query
Accept-Encoding: gzip

Version of AWS SDK for Go? v1.3.0

Version of Go (go version)? go1.15.8 darwin/amd64

To Reproduce (observed behavior)

func TestTimestream(t *testing.T) {
    a := assert.New(t)
    cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("us-east-1"))
    if err != nil {
        log.Fatalf("unable to load SDK config, %v", err)
    }
    timestreamClient := timestreamquery.NewFromConfig(cfg, func(o *timestreamquery.Options) {
        o.ClientLogMode |= aws.LogRequestWithBody
    })
    _, err = timestreamClient.Query(context.TODO(), &timestreamquery.QueryInput{})
    if err != nil {
        log.Println(err)
    }
    a.Nil(err)
}

Expected behavior The query should execute successfully.

skmcgrail commented 3 years ago

Thanks for bring this to our attention @kochie, the AWS SDK for Go V2 has not implemented the endpoint discovery protocol that is required by this service. This is one of the few if only services that this feature is not optional with, and we should have not shipped it since its not usable without a workaround. I will update this comment here shortly on how you can temporarily work around this issue.

kochie commented 3 years ago

All good @skmcgrail! Worth checking if this is also the case for timestreamwrite as well, since I haven't checked that yet.

jasdel commented 2 years ago

The SDK added support for endpoint discovery and was available starting with service/timestreamwrite/v1.3.0 of timestreamwrite module.

github-actions[bot] commented 2 years ago

⚠️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.