Fork me on GitHub
#aws
<
2022-07-11
>
jjttjj20:07:29

I keep getting the following error when attempting to use timestream from aws-api. Any tips on how to debug this? It seems to be happening on all the :timestream-write endpoints. I'm using the latest deps for the api/endpoints/services.

(def tsw (aws/client {:api :timestream-write
                      :region "us-east-1"}))

(aws/invoke tsw
  {:op      :CreateDatabase
   :request {:DatabaseName "test123"}})
{:__type                       "com.amazon.coral.service#UnknownOperationException",
 :cognitect.anomalies/category :cognitect.anomalies/not-found}
(meta
  (aws/invoke tsw
    {:op      :CreateDatabase
     :request {:DatabaseName "test123"}}))

{:http-request
 {:request-method :post,
  :scheme         :https,
  :server-port    443,
  :uri            "/",
  :headers
  {"x-amz-date"   "20220711T200159Z",
   "x-amz-target" "Timestream_20181101.CreateDatabase",
   "content-type" "application/x-amz-json-1.0",
   "accept"       "application/json",
   "host"         "",
   "authorization"
   "..."},
  :body
  #object[java.nio.HeapByteBuffer 0x1ad00694 "java.nio.HeapByteBuffer[pos=0 lim=26 cap=26]"],
  :server-name    ""},
 :http-response
 {:status 404,
  :headers
  {"x-amzn-requestid" "b6d35cfb-c4df-4c2c-b819-445df0ed9d65",
   "content-length"   "63",
   "date"             "Mon, 11 Jul 2022 20:01:58 GMT",
   "content-type"     "application/x-amz-json-1.0"},
  :body
  #object[java.io.BufferedInputStream 0xbf8e637 "java.io.BufferedInputStream@bf8e637"]}}

jjttjj20:07:18

Ok I got it. Timestream requires a custom endpoint described here: https://docs.aws.amazon.com/timestream/latest/developerguide/API_DescribeEndpoints.html So to use the cognitect lib you need to make a client, get the endpoint address, then make a new client using that endpoint adddress, like so: (def tsw (aws/client {:api :timestream-write :region "us-east-1" :endpoint-override {:hostname (-> (aws/invoke (aws/client {:api :timestream-write :region "us-east-1"}) {:op :DescribeEndpoints :request {}}) :Endpoints first :Address)}}))

👍 1