There is docs about error-handling inside ions?
Ions has a nice logging that I can see in cloudwatch
but there is no logs about pedestal on there
Only ERROR logs are available in ions. If you need to troubleshoot something you can use cast
I think that datomic ions could provide a standard request-logger
can I open a issue for that? Maybe I'll do a PR tomorrow.
@souenzzo, I’m not following. Are you referring to the Pedestal.ions project?
If so, request logging can be done at the api gateway level
I think that pedestal.ions
could provide a standard request-logger
So Ions only log ERROR
Datomic Ions
humm
Ok
all other log levels are ignored
which is why you don’t see request logging
I will just do a error-handler
but you do have api gateway logs
or you can cast
but I don’t think Pedestal.ions should use cast
for such things
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
I think that it's because of "Set-Cookie":["ring-session=54747343-28c7-4e53-9441-2cb1d69b2e56;Path=\/;HttpOnly"]
https://aws.amazon.com/premiumsupport/knowledge-center/malformed-502-api-gateway/
root: https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/middleware/cookies.clj#L142
I will try to add one string/join ";" before :io.pedestal.http.ring-middlewares/session
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#L169Hmm 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.
@souenzzo thanks a bunch for digging into this. I’ll look into it soon as well!