silverwolf-x/project / errors /no-server-import-in-page.mdx
silverwolf-x's picture
download
raw
590 Bytes
---
title: No Server Import In Page
---
> Prevent usage of `next/server` outside of `proxy.js`.
## Why This Error Occurred
`next/server` was imported outside of `proxy.{js,ts}`.
## Possible Ways to Fix It
Only import and use `next/server` in a file located within the project root directory: `proxy.{js,ts}`.
```ts filename="proxy.ts"
import type { NextFetchEvent, NextRequest } from 'next/server'
export function proxy(req: NextRequest, ev: NextFetchEvent) {
return new Response('Hello, world!')
}
```
## Useful Links
- [Proxy](/docs/pages/api-reference/file-conventions/proxy)

Xet Storage Details

Size:
590 Bytes
·
Xet hash:
b85b587052661ad349ea40c7b392114a46572bfde7bf317d101555bdaf62b954

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.