module.web icon indicating copy to clipboard operation
module.web copied to clipboard

Issue with nested reitit routes in upcoming version

Open branch14 opened this issue 9 months ago • 4 comments

In the upcoming version there seems to be an issue with nested reitit routes.

Flat routes work

:routes
   [["/ping" :my-test/ping]
    ["/pong" :my-test/pong]]

But when specified in nested form

:routes
   [["/v1"
     ["/ping" :my-test/ping]
     ["/pong" :my-test/pong]]]

only the first route works. The /v1/pong route results in a 404.

I checkd with

(require '[reitit.core :as r])
(-> "duct.edn"
        slurp
        (str/replace "#ig/ref" "")
        read-string
        :system
        :duct.module/web
        :routes
        r/router
        r/routes)

and the result seems fine.

Addendum:

Well at least the error message leads to the conclusion that it wants to respond with a 404. What I actually get is Error 500 java.lang.IllegalArgumentException: No implementation of method: :write-body-to-stream of protocol: #&apos;ring.core.protocols/StreamableResponseBody found for class: clojure.lang.PersistentArrayMap and then SERVLET:</th><td>org.eclipse.jetty.servlet.ServletHandler$Default404Servlet.

This is with

org.duct-framework/main {:mvn/version "0.1.8"}
org.duct-framework/module.web {:mvn/version "0.12.7"}

branch14 avatar May 09 '25 20:05 branch14

Thanks for the bug report! I'll investigate, but it might take me a couple of weeks to find time to do so.

weavejester avatar May 15 '25 12:05 weavejester

I've released 0.12.8 that should fix this issue. Please can you confirm?

weavejester avatar Jun 08 '25 12:06 weavejester

Actually, please stand by. I've found another issue that I think is the true root cause of this.

weavejester avatar Jun 08 '25 14:06 weavejester

Okay, 0.12.9 should have fixed all issues with nesting.

weavejester avatar Jun 08 '25 21:06 weavejester