aws

http://status.aws.amazon.com/ https://www.expeditedssl.com/aws-in-plain-english
viesti 2020-12-11T11:59:36.210600Z

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

viesti 2020-12-11T12:00:09.211200Z

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

dabrazhe 2020-12-11T19:23:53.212Z

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 "<https://s000.kinesisvideo.eu-west-1.amazonaws.com>" cam.mkv

dabrazhe 2020-12-11T19:24:06.212200Z

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")}))

dabrazhe 2020-12-11T19:25:09.212800Z

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}})

dabrazhe 2020-12-14T21:31:05.216700Z

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

lukasz 2020-12-14T22:06:44.216900Z

if you're using clojure.tools.logging 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

dabrazhe 2020-12-11T19:26:16.213400Z

The json error

{:cognitect.anomalies/category :cognitect.anomalies/fault,
 :cognitect.aws.client/throwable
   #error
    {:cause "JSON error (unexpected character): &lt;",
     :trace
       [[clojure.data.json$_read invokeStatic "json.clj"
         230]
        [clojure.data.json$_read invoke "json.clj" 181]
        [clojure.data.json$read invokeStatic "json.clj" 276]
        [clojure.data.json$read doInvoke "json.clj" 232]
        [clojure.lang.RestFn applyTo "RestFn.java" 139]
        [clojure.core$apply invokeStatic "core.clj" 667]
        [clojure.core$apply invoke "core.clj" 660]
        [clojure.data.json$read_str invokeStatic "json.clj"
         282]
        [clojure.data.json$read_str doInvoke "json.clj" 278]
        [clojure.lang.RestFn invoke "RestFn.java" 439]
        [cognitect.aws.protocols.common$json_parse_error
         invokeStatic "common.clj" 42]
        [cognitect.aws.protocols.common$json_parse_error
         invoke "common.clj" 40]
        [cognitect.aws.protocols.rest$parse_http_response
         invokeStatic "rest.clj" 261]
        [cognitect.aws.protocols.rest$parse_http_response
         invoke "rest.clj" 249]
        [cognitect.aws.protocols.rest_json$eval32496$fn__32497
         invoke "rest_json.clj" 61]
        [clojure.lang.MultiFn invoke "MultiFn.java" 239]
        [cognitect.aws.client$handle_http_response
         invokeStatic "client.clj" 48]
        [cognitect.aws.client$handle_http_response invoke
         "client.clj" 43]
        [cognitect.aws.client$send_request$fn__12219$state_machine__6619__auto____12246$fn__12249
         invoke "client.clj" 111]
        [cognitect.aws.client$send_request$fn__12219$state_machine__6619__auto____12246
         invoke "client.clj" 107]
        [clojure.core.async.impl.ioc_macros$run_state_machine
         invokeStatic "ioc_macros.clj" 978]
        [clojure.core.async.impl.ioc_macros$run_state_machine
         invoke "ioc_macros.clj" 977]
        [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped
         invokeStatic "ioc_macros.clj" 982]
        [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped
         invoke "ioc_macros.clj" 980]
        [clojure.core.async.impl.ioc_macros$take_BANG_$fn__6637
         invoke "ioc_macros.clj" 991]
        [clojure.core.async.impl.channels.ManyToManyChannel$fn__623$fn__624
         invoke "channels.clj" 95]
        [clojure.lang.AFn run "AFn.java" 22]
        [java.util.concurrent.ThreadPoolExecutor runWorker
         "ThreadPoolExecutor.java" 1135]
        [java.util.concurrent.ThreadPoolExecutor$Worker run
         "ThreadPoolExecutor.java" 635]
        [clojure.core.async.impl.concurrent$counted_thread_factory$reify__492$fn__493
         invoke "concurrent.clj" 29]
        [clojure.lang.AFn run "AFn.java" 22]
        [java.lang.Thread run "Thread.java" 844]],
     :via [{:at [clojure.data.json$_read invokeStatic
                 "json.clj" 230],
            :message "JSON error (unexpected character): &lt;",
            :type java.lang.Exception}]}}

dabrazhe 2020-12-11T19:28:00.215300Z

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.

lukasz 2020-12-11T22:19:46.215600Z

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

lukasz 2020-12-11T22:20:01.215800Z

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