Fork me on GitHub

error sounds like xml stuff landing where json expected, wonder if kinesis-video-media wire format is supported via aws-api 😬


sometimes hard to cook one up, but maybe a small reproducible example would help


Sure, perhaps you will see what I am missing. The aws-cli command works fine.

aws kinesis-video-media get-media --stream-arn "arn:aws:kinesisvideo:eu-west-1:9000ACCOUNT:stream/camera1/1607464961761" --start-selector StartSelectorType="NOW" --p devpl2 --endpoint-url "" cam.mkv


I am able to invoke on the :kinesisvideo client and get Endpoint and StreamArn without any issues. To read from the stream I am creating a :kinesis-video-media client, which is created fine.

(def kvmedia (aws/client {:api :kinesis-video-media :region "eu-west-1" :endpoint kvs-endpoint :credentials-provider (cred/profile-credentials-provider "devpl2")}))


What breaks is invoke on the :kinesis-video-media client. Whatever I invoke with results in the cryptic json error.

(aws/invoke kvmedia {:op :GetMedia 
    :request {:StartSelector {:StartSelectorType "EARLIEST"}
                               :StreamARN stream-arn}})


The json error

{:cognitect.anomalies/category :cognitect.anomalies/fault,
    {:cause "JSON error (unexpected character): <",
       [[$_read invokeStatic "json.clj"
        [$_read invoke "json.clj" 181]
        [$read invokeStatic "json.clj" 276]
        [$read doInvoke "json.clj" 232]
        [clojure.lang.RestFn applyTo "" 139]
        [clojure.core$apply invokeStatic "core.clj" 667]
        [clojure.core$apply invoke "core.clj" 660]
        [$read_str invokeStatic "json.clj"
        [$read_str doInvoke "json.clj" 278]
        [clojure.lang.RestFn invoke "" 439]
         invokeStatic "common.clj" 42]
         invoke "common.clj" 40]
         invokeStatic "rest.clj" 261]
         invoke "rest.clj" 249]
         invoke "rest_json.clj" 61]
        [clojure.lang.MultiFn invoke "" 239]
         invokeStatic "client.clj" 48]
        [$handle_http_response invoke
         "client.clj" 43]
         invoke "client.clj" 111]
         invoke "client.clj" 107]
         invokeStatic "ioc_macros.clj" 978]
         invoke "ioc_macros.clj" 977]
         invokeStatic "ioc_macros.clj" 982]
         invoke "ioc_macros.clj" 980]
         invoke "ioc_macros.clj" 991]
         invoke "channels.clj" 95]
        [clojure.lang.AFn run "" 22]
        [java.util.concurrent.ThreadPoolExecutor runWorker
         "" 1135]
        [java.util.concurrent.ThreadPoolExecutor$Worker run
         "" 635]
         invoke "concurrent.clj" 29]
        [clojure.lang.AFn run "" 22]
        [java.lang.Thread run "" 844]],
     :via [{:at [$_read invokeStatic
                 "json.clj" 230],
            :message "JSON error (unexpected character): <",
            :type java.lang.Exception}]}}


Just guessing here - since it starts with < - that means you're getting an XML/HTML response?


You can bump logging level of the underlying http client and see if that helps


That's the whole errors I am getting in response. What do you meany by logging level by the client?


if you're using and switch the log level from info to debug, you'll see debug logs from the underlying HTTP client (I believe it's based on Jetty) - this way you'll see all of the request details


The json error is in the thread. I even found the boto3 api for :kinesis-video-media and it seems like I am doing things in the same way.