1

As the title says, I'm trying to write a bunch of records to timestream, but I keep getting "ValidationException" without any further information, so I have no idea what should be fixed. The exact error response is:

operation error Timestream Write: WriteRecords, https response error StatusCode: 400, RequestID: XXXXXXXXXXXXXX, ValidationException:

It made me think that it was a multiline string and somehow the logging framework wasn't logging properly, but I tried splitting by \n and all I got was a size 1 list with the same text.

Any ideas?

David Perez
  • 478
  • 5
  • 17

1 Answers1

0

For some reason, the validation error is wrapped multiple errors deep. To get to the validation error message, you need the following:

import (
    "fmt"
    "github.com/aws/aws-sdk-go-v2/aws"
    "github.com/aws/aws-sdk-go-v2/aws/transport/http"
    "github.com/aws/aws-sdk-go-v2/service/timestreamwrite/types"
    "github.com/aws/smithy-go"
)
responseError := err.(*smithy.OperationError).Unwrap().(*http.ResponseError)
validationError := responseError.Unwrap().(*types.ValidationException)
fmt.Println(validationError.ErrorMessage())
Eric Aya
  • 69,473
  • 35
  • 181
  • 253
wolframhempel
  • 1,094
  • 10
  • 12