Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: middleware next() does not invoke handlers #2657

Closed
timreichen opened this issue Sep 21, 2024 · 0 comments · Fixed by #2680
Closed

bug: middleware next() does not invoke handlers #2657

timreichen opened this issue Sep 21, 2024 · 0 comments · Fixed by #2680

Comments

@timreichen
Copy link
Contributor

timreichen commented Sep 21, 2024

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/[email protected]
  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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant