Files
vercel__next.js/errors/next-response-next-in-app-route-handler.mdx
Jiwon Choi bc59f210b0 docs: Deprecation of Middleware (#84710)
This PR removes middleware docs and adds a "Migration to Proxy" section
to the Proxy docs, which explains the rationale for the renaming to
Proxy and provides a migration guide.

Did not remove `middleware-upgrade-docs` as it's an upgrade doc from the
legacy middleware.

Below are untouched as they need codebase changes:

- `instrumentation` docs - `onRequestError` has `context.routeType` as
`'middleware'`
- `adapterPath` docs - has `MiddlewareMatcher` type example
- `ProxyConfig` - has a user-facing `MiddlewareMatcher` type

---------

Co-authored-by: Joseph Chamochumbi <joseph.chamochumbi@vercel.com>
2025-10-17 20:03:13 +02:00

19 lines
618 B
Plaintext

---
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 Proxy.
The Route Handler is considered the end of the proxy "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/api-reference/file-conventions/route)
- [`NextResponse`](/docs/app/api-reference/functions/next-response)