pedestal

Miguel 2025-10-17T09:26:43.096779Z

Hi there, our update to 0.8.0 didn't go as smooth as expected. We are using lacinia-pedestal as well and found out that graphql-data-interceptor out of the lacinia-pedestal/default-interceptors seems to be trying to read the data from the request body, instead of reading the data from the request json-params. So we ended up re-writing the graphql-data-interceptor, I assume since we seem to be the only ones with this issues and there was no matching update for lacinia-pedestal our setup is off.

(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))}))