By default, the pedestal dev interceptor pprints the context when an exception occurs. Sometimes, the context can be Very Large, which makes for a hot cpu locally. Have others been sad about this, and what strategies have you employed to mitigate it?
ha ha the struggle is real
I also occasionally find this more noisy and confusing than it is helpful, but I keep thinking for some gnarly issue one day I’ll be thankful the information is all there
I can see two ways to deal with this and there both applications specific: 1. Leverage the existing print vars to control how much is printed. Clojure’s pprint impl respects those. 2. Implement your own dev interceptor variant which does not pprint the context.
How to configure a /*
in AWS API Gateway to get pedestal working in IONS?
@souenzzo /{proxy+}
is not sufficient?
Have you tried this sample? https://github.com/pedestal/pedestal-ions-sample
@ddeaguiar
I'm using proxy+ (generated by clicking in proxy checkbox)
when I call <https://xxx.execute-api.us-east-1.amazonaws.com/dev/>
it send's me {"message":"Missing Authentication Token"}
when I call <https://xxx.execute-api.us-east-1.amazonaws.com/dev/my-app-Compute-ABC123-app>
it return my handler, as expected
when I call <https://xxx.execute-api.us-east-1.amazonaws.com/dev/my-app-Compute-ABC123-app/foo>
it returns {"message":"Missing Authentication Token"}
again
ATM I'm with #{["/*" :get hello]}
that returns {:body (pr-str path-info) :status 200}
hrm /proxy+ should route any child path to the ion
to get /
to work, you need to set up the ANY
method on /
to proxy requests to the lambda. Apparently /proxy+
doesn’t handle that
There’s probably a better way to do that…
should all my routes be ["/:app/my-actual-path/..." :get ,,,]
?
no, the relative path should suffice
Example: https://github.com/pedestal/pedestal-ions-sample/blob/master/src/ion_sample/service.clj#L142-L148
Oh, I need to "deploy" my api gateway config
sorry @ddeaguiar. Now it's working
Ah yes, deployment is important 🙂
That’s bitten me before…
Choose Add Binary Media Type, add the */* type.
It will solve the fact of everything comes in base64 ?
My understanding is that by setting that, API gateway passes the data through to the ion unaltered
well to the lambda proxy’ing the ion
BTW, that last bit is an important point. Most meaningful logs will not be in the lambda logs but the compute group logs
easy to forget that
Can pedestal still use ring middlewares as interceptors? I found the ring_middlewares sample repo but it’s in terms of pedestal 0.1.2
Hi @jonathan617! Pedestal uses interceptors instead of middleware but there are a number of middleware that have been wrapped by interceptors (https://github.com/pedestal/pedestal/blob/master/service/src/io/pedestal/http/ring_middlewares.clj) and, in most cases, it’s pretty straight forward to create interceptor wrappers of your own. Here’s a sample which does just that https://github.com/pedestal/pedestal/blob/master/samples/buddy-auth/src/buddy_auth/service.clj#L51-L72.