CLI to build and develop Next.js apps for Cloudflare Pages

[๐Ÿ› Bug]: cloudflare broken with Next ^5.2.0 [await fetch]#956

Closed
Opened 3/11/20256 commentsby gavan1
gavan1

### next-on-pages environment related information ``` export default async function Page() { const data = await fetch('https://api.vercel.app/blog') const posts = await data.json() return ( <ul> {posts.map((post) => ( <li key={post.id}>{post.title}</li> ))} </ul> ) } ``` Any RSC page as documented by NEXt.js that has and top level await fetch call will cause an "internal server error" and on console. `Error: Disallowed operation called within global scope. Asynchronous I/O (ex: fetch() or connect()), setting a timeout, and generating random values are not allowed within global scope. To fix this error, perform this operation within a handler. https://developers.cloudflare.com/workers/runtime-apis/handlers/` ### Description Any RSC page as documented by NEXt.js that has and top level await fetch call will cause an "internal server error" ### Reproduction ``` export default async function Page() { const data = await fetch('https://api.vercel.app/blog') const posts = await data.json() return ( <ul> {posts.map((post) => ( <li key={post.id}>{post.title}</li> ))} </ul> ) } ```

AI Analysis

This issue appears to be discussing a feature request or bug report related to the repository. Based on the content, it seems to be resolved. The issue was opened by gavan1 and has received 6 comments.

Add a comment
Comment form would go here