Fork me on GitHub
#pedestal
<
2019-02-27
>
donaldball14:02:41

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?

👍 5
souenzzo17:02:31

I store datascript db in ctx When my repl freezes, I know that pedestal is trying to print it 😞

donaldball17:02:26

ha ha the struggle is real

ddeaguiar18:02:37

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.

ccann18:02:18

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

souenzzo19:02:49

How to configure a /* in AWS API Gateway to get pedestal working in IONS?

ddeaguiar19:02:16

@souenzzo /{proxy+} is not sufficient?

souenzzo20:02:17

@ddeaguiar I'm using proxy+ (generated by clicking in proxy checkbox) when I call it send's me {"message":"Missing Authentication Token"} when I call it return my handler, as expected when I call it returns {"message":"Missing Authentication Token"} again

souenzzo20:02:43

ATM I'm with #{["/*" :get hello]} that returns {:body (pr-str path-info) :status 200}

ddeaguiar20:02:38

hrm /proxy+ should route any child path to the ion

ddeaguiar20:02:32

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

ddeaguiar20:02:48

There’s probably a better way to do that…

souenzzo20:02:01

should all my routes be ["/:app/my-actual-path/..." :get ,,,] ?

ddeaguiar20:02:14

no, the relative path should suffice

souenzzo21:02:50

Oh, I need to "deploy" my api gateway config

souenzzo21:02:03

sorry @ddeaguiar. Now it's working

ddeaguiar21:02:22

Ah yes, deployment is important 🙂

ddeaguiar21:02:31

That’s bitten me before…

souenzzo21:02:28

Choose Add Binary Media Type, add the */* type. It will solve the fact of everything comes in base64 ?

ddeaguiar21:02:20

My understanding is that by setting that, API gateway passes the data through to the ion unaltered

ddeaguiar21:02:34

well to the lambda proxy’ing the ion

ddeaguiar22:02:48

BTW, that last bit is an important point. Most meaningful logs will not be in the lambda logs but the compute group logs

ddeaguiar22:02:56

easy to forget that

Jonathan22:02:28

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

ddeaguiar14:02:44

Hi @U9UQ36CJJ! 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.