Fork me on GitHub
#pedestal
<
2019-03-27
>
souenzzo18:03:32

There is docs about error-handling inside ions?

souenzzo18:03:52

Ions has a nice logging that I can see in cloudwatch

souenzzo18:03:05

but there is no logs about pedestal on there

ddeaguiar18:03:47

Only ERROR logs are available in ions. If you need to troubleshoot something you can use cast

souenzzo18:03:39

I think that datomic ions could provide a standard request-logger

souenzzo18:03:48

can I open a issue for that? Maybe I'll do a PR tomorrow.

ddeaguiar18:03:21

@souenzzo, I’m not following. Are you referring to the Pedestal.ions project?

ddeaguiar18:03:47

If so, request logging can be done at the api gateway level

souenzzo18:03:54

I think that pedestal.ions could provide a standard request-logger

ddeaguiar18:03:10

So Ions only log ERROR

ddeaguiar18:03:14

Datomic Ions

ddeaguiar18:03:22

all other log levels are ignored

ddeaguiar18:03:34

which is why you don’t see request logging

souenzzo18:03:39

I will just do a error-handler

ddeaguiar18:03:50

but you do have api gateway logs

ddeaguiar18:03:01

or you can cast

ddeaguiar18:03:19

but I don’t think Pedestal.ions should use cast for such things

souenzzo19:03:49

My lambda always returns 502

Wed Mar 27 19:17:50 UTC 2019 : Received response. Status: 200, Integration latency: 171 ms
Wed Mar 27 19:17:50 UTC 2019 : Endpoint response headers: {Date=Wed, 27 Mar 2019 19:17:50 GMT, Content-Type=application/json, Content-Length=511, Connection=keep-alive, x-amzn-RequestId=xxxx-xxxx-xxxx-xxxx-xxx, x-amzn-Remapped-Content-Length=0, X-Amz-Executed-Version=$LATEST, X-Amzn-Trace-Id=root=1-xxxx-xxxx;sampled=0}
Wed Mar 27 19:17:50 UTC 2019 : Endpoint response body before transformations: {"body":"ezpjb21taXQgbmlsfQ==","statusCode":200,"headers":{"X-Frame-Options":"DENY","X-XSS-Protection":"1; mode=block","X-Download-Options":"noopen","Strict-Transport-Security":"max-age=31536000; includeSubdomains","Set-Cookie":["ring-session=54747343-28c7-4e53-9441-2cb1d69b2e56;Path=\/;HttpOnly"],"X-Permitted-Cross-Domain-Policies":"none","X-Content-Type-Options":"nosniff","Content-Security-Policy":"script-src 'self' 'unsafe-inline' 'unsafe-eval'","Content-Type":"application\/edn"},"isBase64Encoded":true}
Wed Mar 27 19:17:50 UTC 2019 : Execution failed due to configuration error: Malformed Lambda proxy response
Wed Mar 27 19:17:50 UTC 2019 : Method completed with status: 502

souenzzo19:03:10

I think that it's because of "Set-Cookie":["ring-session=54747343-28c7-4e53-9441-2cb1d69b2e56;Path=\/;HttpOnly"]

souenzzo19:03:28

I will try to add one string/join ";" before :io.pedestal.http.ring-middlewares/session

souenzzo20:03:58

Should I PR something like this?

(def join-headers
  (io.pedestal.interceptor/interceptor {:name  ::join-headers
                                        :leave (fn [{{:keys [headers]} :response
                                                     :as               ctx}]
                                                 (if (map? headers)
                                                   (assoc-in ctx [:response :headers] (into (empty headers)
                                                                                            (map (fn [[k v]]
                                                                                                   [k (if (coll? v)
                                                                                                        (string/join ";" v)
                                                                                                        v)]))
                                                                                            headers))
                                                   ctx))}))

https://github.com/pedestal/pedestal.ions/blob/master/src/io/pedestal/ions.clj#L169

ddeaguiar20:03:58

Hmm yeah that looks like an issue. I can take a look at it in more detail on Friday. Can you create an issue with Pedestal.ions? You can also create a PR if you like as well.

👍 5
ddeaguiar20:03:16

@souenzzo thanks a bunch for digging into this. I’ll look into it soon as well!