rsnext/errors/next-response-next-in-app-route-handler.mdx
Delba de Oliveira 44d1a1cb15
docs: Migrate error messages to MDX and App Router. (#52038)
This PR is part of a larger effort to migrate error messages to MDX and
use App Router: https://github.com/vercel/front/pull/23459
2023-07-05 06:11:16 -07:00

16 lines
626 B
Text

---
title: '`NextResponse.next()` used in a App Route Handler'
---
## Why This Error Occurred
App Route Handler's do not currently support using the `NextResponse.next()` method to forward to the next middleware because the handler is considered the endpoint to 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
- [`Response`](https://developer.mozilla.org/en-US/docs/Web/API/Response)
- [`NextResponse`](/docs/pages/api-reference/functions/next-server#nextresponse)