pedestal

donaldball 2019-02-27T14:20:41.034500Z

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?

đź‘Ť 1
donaldball 2019-02-27T17:32:26.035800Z

ha ha the struggle is real

ccann 2019-02-27T18:21:18.036800Z

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

2019-02-27T18:22:37.036900Z

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.

souenzzo 2019-02-27T19:33:49.037700Z

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

2019-02-27T19:42:16.038300Z

@souenzzo /{proxy+} is not sufficient?

2019-02-27T19:43:31.038700Z

Have you tried this sample? https://github.com/pedestal/pedestal-ions-sample

souenzzo 2019-02-27T20:13:17.039300Z

@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

souenzzo 2019-02-27T20:15:43.040300Z

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

2019-02-27T20:27:38.041300Z

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

2019-02-27T20:28:32.042100Z

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

2019-02-27T20:28:48.042400Z

There’s probably a better way to do that…

souenzzo 2019-02-27T20:30:01.043400Z

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

2019-02-27T20:31:14.043900Z

no, the relative path should suffice

souenzzo 2019-02-27T21:06:50.044600Z

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

souenzzo 2019-02-27T21:07:03.044900Z

sorry @ddeaguiar. Now it's working

2019-02-27T21:07:22.045200Z

Ah yes, deployment is important 🙂

2019-02-27T21:07:31.045500Z

That’s bitten me before…

souenzzo 2019-02-27T21:22:28.045900Z

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

2019-02-27T21:32:20.046600Z

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

2019-02-27T21:32:34.046900Z

well to the lambda proxy’ing the ion

2019-02-27T22:08:48.047600Z

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

2019-02-27T22:08:56.047800Z

easy to forget that

Jonathan 2019-02-27T22:29:28.049300Z

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

2019-02-28T14:11:44.002500Z

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.