This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-24
Channels
- # announcements (5)
- # aws (5)
- # aws-lambda (6)
- # babashka (6)
- # beginners (48)
- # calva (54)
- # clj-commons (12)
- # clj-kondo (39)
- # cljfx (3)
- # cljs-dev (11)
- # clojure (91)
- # clojure-europe (25)
- # clojure-uk (3)
- # clojurescript (16)
- # cursive (2)
- # data-oriented-programming (6)
- # datomic (8)
- # emacs (10)
- # events (3)
- # fulcro (2)
- # functionalprogramming (2)
- # graalvm (4)
- # graphql (2)
- # helix (1)
- # honeysql (4)
- # jobs (1)
- # malli (4)
- # nextjournal (21)
- # off-topic (5)
- # other-languages (4)
- # overtone (3)
- # reitit (17)
- # releases (2)
- # rewrite-clj (6)
- # ring (6)
- # shadow-cljs (37)
I'm running into a situation where Retit doesn't inject :form-params
, :params
, and :query
into a request before it passes it off to the middleware stack for routes with {:middleware []}
— any idea what could be causing this or how I can debug it? It's causing reitit.ring.coercion/coerce-request-middleware
to throw an exception.
you need to have the parameter-middleware (from ring or reitit, doing the same) for that.
there is a request-debugging tool that shows the request & response before and after each middleware step, which is useful in debugging.
there should be “api-middleware” with all the releavant mw in it (and in right order)
I am using ring.middleware.params/wrap-params
at the start of my middleware stack
and I did try using
if that's what you mean
nope — well, the first 'frame' it prints (`--- :request ---`) is missing those keys for the routes with :middleware []
perhaps it's just skipping over wrap-params
when printing, and that middleware doesn't get run for these routes?
I just tried writing a middleware transformer that just prints out which middleware is applied to each route, and curiously enough, it seems like the middleware stack is reversed for the routes with {:middleware []}
so that's probably the problem — the question then would be, what could be causing it?
(...actually, I realized it's not that
"skips" wrap-params
— it just doesn't print the name of that particular middleware. The problem is indeed that it get applied first instead of last for routes with {:middleware []}
)
@U055NJ5CC I think I figured it out, and it seems to be a bug in Reitit
specifically, this behavior only occurs when the list of middleware passed to reitit.ring/router
is a non-vector sequence
if I change my router call to (reitit.ring/router router (update-in config [:data :middleware] vec))
, the problem goes away
my guess would be that you're using something like reduce
with conj
when joining together middleware vectors