We are using Pedestal with Lacinia. After upgrading from 0.7 to 0.8 we started getting some inconsistent errors
clojure.lang.ExceptionInfo: java.io.EOFException in Interceptor :io.pedestal.http.body-params/body-params - JSON parse error - EOF while reading string:
The migration was also not easy since we had to add a custom interceptor for lacinia-pedestal.
Which felt wrong in the first place but Lacinia wants to parse the request body itself, despite the fact that pedestal already does this.
It appears that with the update the body can no longer be parsed twice which broke things.
The custom interceptor tells lacinia to use what has already been parsedThanks you for the reply and the great work 🙏
This the interceptor we built
(defn graphql-json-interceptor
"Lacinias interceptor that reads from :json-params instead of parsing :body (since io.pedestal.http.body-params already parsed it)"
[]
(pedestal-interceptor/interceptor
{:name ::lacinia-pedestal/graphql-data
:enter (fn [context]
(let [{:keys [query variables operationName]}
(get-in context [:request :json-params])]
(if query
(update context :request assoc
:graphql-query query
:graphql-vars variables
:graphql-operation-name operationName)
(assoc context :response
{:status 400
:body "JSON 'query' key is missing or blank"}))))
:leave (fn [context]
(update context :request dissoc
:graphql-query
:graphql-vars
:graphql-operation-name))
:error (fn [context _exception]
(update context :request dissoc
:graphql-query
:graphql-vars
:graphql-operation-name))}))Yes, need to do a proper upgrade of lacinia-pedestal for 0.8 that uses Pedestal more correctly. Juggling a lot of plates, as usual.
Hey all! I’m working on addressing a CVE from Jetty 11 in our code base. It seems like the only path for us is to upgrade to pedestal 0.8 for Jetty 12, since Jetty 11 is EoL. The last thing that seems to be preventing us from upgrading pedestal is our lacinia pedestal dependency. Is the lacinia-pedestal’s upgrade to pedestal 0.8 being worked on? Trying to understand upgrade options 🤔 Thanks!
We had a few edge cases in tests that relied on cheshire's behavior (charred is more strict) so for 0.8.2 we're going to make the JSON processor configurable. reviewplease https://github.com/pedestal/pedestal/pull/985