denoland/fresh

bug: middleware `next()` does not invoke handlers

timreichen opened this issue · 0 comments

middleware declared in _middleware files do not work properly when ctx.next() is called.

/
├── /main.ts
├── /routes
│   ├── index.tsx
│   └── middleware.tsx
├── /utils.ts
└── ...

Steps to reproduce:

  1. create new fresh project with deno run -Ar jsr:@fresh/init@2.0.0-alpha.20
  2. add /routes/_middleware.tsx file
  3. add simple middleware code
// /routes/_middleware.ts
import { define } from "../utils.ts";

export default define.middleware((ctx) => {
  console.log(`${ctx.req.method} ${ctx.req.url}`);
  return ctx.next();
});

This should invoke the routes/index.tsx handler according to the doc but always returns a not found response.

The same middleware declared in main.ts works as expected.