Unverified Commit 6274733f authored by Rich Haines's avatar Rich Haines Committed by GitHub

Fix error page doc for no server import in page (#32164)

* Fix error page doc for no server import in page

* Feedback changes
parent 68d6d1ad
......@@ -2,13 +2,13 @@
### Why This Error Occurred
`next/server` was imported in a page outside of `pages/_middleware.js` (or `pages/_middleware.tsx` if you are using TypeScript)
`next/server` was imported outside of `pages/**/_middleware.{js,ts}`.
### Possible Ways to Fix It
Only import and use `next/server` within `pages/_middleware.js` (or `pages/_middleware.tsx`) to add middlewares.
Only import and use `next/server` in a file located within the pages directory: `pages/**/_middleware.{js,ts}`.
```jsx
```ts
// pages/_middleware.ts
import type { NextFetchEvent, NextRequest } from 'next/server'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment