rsnext/errors/next-response-next-in-app-route-handler.mdx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
640 B
Text
Raw Normal View History

---
title: '`NextResponse.next()` used in a Route Handler in the App Router'
---
## Why This Error Occurred
Route Handlers in the Next.js App Router do not support using the `NextResponse.next()` method to forward to the next Middleware.
The Route Handler is considered the end of the middleware "chain". Handlers must always return a `Response` object instead.
## Possible Ways to Fix It
Remove the `NextResponse.next()` and replace it with a correct response handler.
## Useful Links
- [Route Handlers](/docs/app/building-your-application/routing/route-handlers)
- [`NextResponse`](/docs/app/api-reference/functions/next-response)