Skip to content

nova_router:execute/2 crashes ({badmap, undefined}) on a /[...] catch-all route #388

Description

@Taure

What happens

A catch-all route crashes nova_router:execute/2 at request time with {badmap, undefined}; the client gets a 500. Exact-path routes on the same listener work fine.

Ranch listener nova_listener ... request process exit with reason
{{badmap,undefined},[{nova_router,execute,2,
   [{file,".../nova/src/nova_router.erl"},{line,104}]}, ...]}

Route

routes(_Env) ->
  [#{prefix => "", security => false, routes => [
      {"/", fun my_page:index/1, #{methods => [get]}},          %% works (200)
      {"/assets/[...]", "static/assets"}                         %% 500, badmap
  ]}].

Both the static-string target ("static/assets") and a fun/1 controller target on the [...] route 500 the same way. Replacing it with explicit exact paths ("/assets/css/app.css", ...) works.

Environment

  • nova @ 9ee7e21ef5f82c9c8b71b0ff6bf0ace08d8b72a3
  • cowboy 2.15.0 (forced to this version by another dep in the project; this may be the trigger - line 104 reads route metadata as a map and gets undefined, suggesting the catch-all match path produces no options map under this cowboy)
  • OTP 29

Workaround

Serve known assets via exact-path routes + a small controller instead of a [...] catch-all. Found while building banto (a Nova + Datastar dashboard). Happy to test a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions