duct-framework / duct-framework/module.web

Issue with nested reitit routes in upcoming version

Open
#23 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Clojure
Stars
22
Forks
22
PR merge metrics
No merged PRs in 30d

Description

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"}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue from the nested :routes example in duct.edn using the listed org.duct-framework/main and module.web versions, then inspect the reitit.core router output and the response path for /v1/pong. Done means both nested routes work and the request no longer produces the 404 or the StreamableResponseBody exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.