Cloudflare Developers

CD

Cloudflare Developers

Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news

Join

Hi everyone. So I have a NextJS app (<15

Hi everyone. So I have a NextJS app (<15.0.0) and was trying to deploy to pages. My has both server and client functions and is still relatively small. While trying to deploy I see the files in /.next/cache are larger than the 25mb limit. Tried to troubleshoot to optimize where I can (don't have many static assets and they're small). Build direct was set to /.next and npm run build as the command. Am I doing something wrong or is it plainly a matter of refactoring everything to use Cloudflare w...

Hey everyone does anyone know where can

Hey everyone does anyone know where can I read about multi tenant project with cloud flare and nextjs

**Error:**

Error: [wrangler:inf] Ready on http://localhost:8788 āœØ Parsed 1 valid header rule. Enable Draft Mode: āœ˜ [ERROR] Error: Invariant: previewProps missing previewModeId this should never happen...

Post hog next-on-pages

does it work on next-on-pages?

We added KV because, well, people asked

We added KV because, well, people asked for it, but my personal opinion is that you should be using cache api since it aligns better with the expected behaviour of the fetch cache (e.g. being regional). And I'm also of the opinion that the eventual consistency of KV completely kills the ability for the cache to work properly because every change to the cache manifest takes 60 seconds to propagate which will mean it'll probably change every request when it shouldnt be

Fixes & issues

If anyone searches this, managed to get it working. My root layout.tsx file had the following:
export const runtime = 'edge';
export const dynamic = 'force-dynamic';
export const revalidate = 0;
export const runtime = 'edge';
export const dynamic = 'force-dynamic';
export const revalidate = 0;
...

Running into an issue when running `npm

Running into an issue when running npm create cloudflare@latest my-next-app -- --framework=next (when creating a new project) or npx @cloudflare/next-on-pages on a existing project. Opens a wsl shell and is then frozen and when closed gives this error. I've already attempted to run the commands within WSL as suggested and the same shell still opens. Running without WSL enabled gives the other error. No other node processes are running, running the command as administrator does not work eith...
No description

25MB file limit next-on-pages

Sure, been on other things the last few days.

Is there any update on Gradual

Is there any update on Gradual Deployments for Pages?

Hello Cloudflare community,

Hello Cloudflare community, I'm encountering an intermittent error in my Next.js application deployed on Cloudflare Workers (next-on-pages). The error occurs in various environments and states: `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/...

It's what Pages functions refers to as

It's what Pages functions refers to as an advanced mode, although it's actually just a regular worker way of doing things. If you wanted to deploy your nextjs app as a completely normal worker (which doesnt sound like the best idea to me), you'll need to come up with a way to manage how you would still expose assets to env.ASSETS.fetch('/{assetPath}'). You'll also end up getting billed a lot more since the _next/static files will all have worker invocations, and you're going to be paying for either KV or R2 to store and serve all your site's assets. Doesn't sound very fun. You're essentially going to be operating what used to be referred to as a Workers Sites deployment. Something Cloudflare have been trying to discourage and get away from people doing, and to instead use Pages....

Caching issues

Documentation(https://github.com/cloudflare/next-on-pages/blob/main/packages/next-on-pages/docs/caching.md) is very vague, it first says "Caching in Next.js applications (thus applications built using @Cloudflare/next-on-pages as well) is enabled by default." But then, it talks about two storage options. There is no sample for either option...

Has anyone got hono+nextjs+d1 working

Has anyone got hono+nextjs+d1 working together? i want to use this stack and deploy on cloudflare pages but wanted to know if i will jump into any bottlenecks so i can be aware of.

This error means that somewhere within

This error means that somewhere within your SSR code you're probably passing a relative path to an URL constructor

[šŸ› Bug]: Failed to read header in page ...

I am trying to set a response header in the middleware and read it in pages or layout routes. But this isn't working. I have filed a bug report here - #797 Quick summary in the thread...

I am getting the error `The script will

I am getting the error The script will never generate a response when trying to use fetch() in my generateMetaData function in NextJS 14. I've seen a lot of similar bugs reported on this but haven't been able to find a solution. Is anyone familiar with this? I can reproduce this locally when running npx @Cloudflare/next-on-pages@1 and then using wrangler to do a preview, otherwise this works on local. The error I was getting before reproducing on local (in my dev cloudflare url) was A hanging Promise was canceled. This happens when the worker runtime is waiting for a Promise from JavaScript to resolve, but has detected that the Promise cannot possibly ever resolve because all code and events related to the Promise's I/O context have already finished....

is it possible to use a service binding

is it possible to use a service binding while developing locally(next dev) to a worker that is already deployed?

Update: I think I've got the Next.js app

Update: I think I've got the Next.js app in a satisfying state: - Moved most server components and server action "magic" to good old client components with api routes HTTP calls from the user's browser. - The data flow just makes more sense mentally, and it gives you a chance to test backend logic from outside the nextjs app (with postman for example). - With Tanstack Query client side you can also retry queries if they go wrong or while waiting for a database update for example....

anyone using baselime with next-on-pages

anyone using baselime with next-on-pages? if so, how?
Next