pedestal

souenzzo 2019-03-27T18:00:32.044400Z

There is docs about error-handling inside ions?

souenzzo 2019-03-27T18:00:52.044900Z

Ions has a nice logging that I can see in cloudwatch

souenzzo 2019-03-27T18:01:05.045300Z

but there is no logs about pedestal on there

2019-03-27T18:03:47.046Z

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

souenzzo 2019-03-27T18:18:39.046500Z

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

souenzzo 2019-03-27T18:19:48.047200Z

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

2019-03-27T18:21:21.047700Z

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

2019-03-27T18:21:47.048500Z

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

souenzzo 2019-03-27T18:21:54.048800Z

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

2019-03-27T18:22:10.049400Z

So Ions only log ERROR

2019-03-27T18:22:14.049600Z

Datomic Ions

souenzzo 2019-03-27T18:22:19.049900Z

humm

souenzzo 2019-03-27T18:22:20.050100Z

Ok

2019-03-27T18:22:22.050300Z

all other log levels are ignored

2019-03-27T18:22:34.050700Z

which is why you don’t see request logging

souenzzo 2019-03-27T18:22:39.050900Z

I will just do a error-handler

2019-03-27T18:22:50.051300Z

but you do have api gateway logs

2019-03-27T18:23:01.051500Z

or you can cast

2019-03-27T18:23:19.051900Z

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

souenzzo 2019-03-27T19:19:49.052600Z

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

souenzzo 2019-03-27T19:20:10.053Z

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

souenzzo 2019-03-27T19:29:28.054300Z

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

souenzzo 2019-03-27T20:15:58.055Z

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

2019-03-27T20:21:58.056200Z

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.

👍 1
souenzzo 2019-03-27T20:39:49.056400Z

https://github.com/pedestal/pedestal.ions/issues/3

2019-03-27T20:42:16.056900Z

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