Hi Dario, could you elaborate on the existing drawbacks and issues? Just starting with next on pages

Hi Dario, could you elaborate on the existing drawbacks and issues? Just starting with next on pages and seems to run fine for us, but before making a switch from Vercel with big projects, want to know the ins-and-outs
16 Replies
thanhle
thanhle9mo ago
But it still works well with Workers. Is it correct?. i am planning use next-on-pages for deploy my nextjs app and use CloudFlare Workers for API route with smart placement. what do you recommend about this setup? You mean this is the Pages Functions?
juanferreras
juanferreras9mo ago
we've been adopting next-on-pages recently and it's been working really, really great (kudos to Dario/James/any other contributors I might be missing!) (on a somewhat similar note to the messages above) I did want to know if either of you had any methods to reliably profile timings in Cloudflare workers – we were surprised to see that:
const t0 = Date.now();
const data = env.KV.get(key);
const t1 = Date.now();
const t0 = Date.now();
const data = env.KV.get(key);
const t1 = Date.now();
seemed to be reporting XXX ms in lab conditions even on cache hits (where in a plain worker we see XX ms_. Then we realized it wasn't KV but rather the first IO we had (and with the CF Workers security measures, we understand we could be measuring things before that I/O that just wait for the I/O to tick?)
James
James9mo ago
I'm not sure about workers because I don't use Workers, I just know that Smart Placement can cause internal errors with Pages. You can try your setup though, I'm not sure if it only happens with Pages functions or if it also happens with static assets
Logan
Logan9mo ago
I have a question. If we were to deploy a server side NextJS app to pages, is there a list of originating IP addresses that app would communicate with or a way to get a list of IPs from our deployment that can be whitelisted on another system we have?
JohnDotAwesome
JohnDotAwesome9mo ago
Someone correct me if I'm wrong, but the IP's of outgoing requests from Workers ought to match Cloudflare's ips's https://cloudflare.com/ips but just because a request is coming from that IP doesn't mean it's legitimate traffic. There's some good info here https://news.ycombinator.com/item?id=26690388
IP Ranges | Cloudflare
This page is intended to be the definitive source of Cloudflare’s current IP ranges.
kentonv
Hi, I'm the tech lead of Cloudflare Workers.This article contains several misunderstandings.If a Cloudflare customer has configured their origin server to respond only to Cloudflare IPs, then they MUST also verify that the "Host" header on any request actually matches their domain name. If they do not verify the Host header, then anyone can sign...
Hacker News
Logan
Logan9mo ago
If that is the case, that is awesome. Will wait on any anti-confirmation.
thanhle
thanhle9mo ago
thank you so much for the infor James
quisi.do
quisi.do9mo ago
Just found this. I've been deploying Next SSG to Pages for a hot minute now. Is this channel for SSR? I wasn't aware of Pages offering SSR. If so, is there any documentation about this?
Hello, I’m Allie!
Yes, it is. #next-on-pages adapts Next’s Serverless code to make it compatible with Pages
Dario
Dario9mo ago
Yes, it's documented here 🙂 https://developers.cloudflare.com/pages/framework-guides/nextjs/ (specifically for Next.js)
Cloudflare Docs
Deploy a Next.js site · Cloudflare Pages docs
React framework for building full-stack web applications.
Pat Branchaud
Pat Branchaud9mo ago
Hey, I’m trying to find a solution for hosting with next-on-pages a full slug translation i18n (ex: fr/blogue, en/blog). Looking for a solution without the use of a middleware like amannn/next-intl does, the only viable I found right now is svobik7/next-roots copying folders on build. Any other ideas or examples your guys are aware of? 3 days of searching now and It seems complicated..
James
James9mo ago
You could maybe use next.config.js rewrites, but that could end up being pretty laborious
Aguilar
Aguilar9mo ago
hey guyss, anyone here has a nextjs 14 using drizzle and cloudflare d1 github repo that i can look at? just trying to see and learn how other people doing it
Jeff
Jeff9mo ago
Hey guys, how might I troubleshoot an: "Error code: 1000" error for a next on pages project? It uses pages router, and the /api route throws status code 403, with a plaintext response of "error code: 1000". Works locally with wrangler pages dev. The logs do not make it to the log tail, so seems its before my app I see online that 1000 implies I'm pointing to a cloudflare ip in some way, but this is just a pages.dev/api/ route, so im not sure how It seems that passing of specific x-vercel-* or cf-* headers was triggering this. The headers were coming from next/headers and may have gotten mixed around by all the trpc context switching going on in the T3stack boilerplate. If anyone runs into this I just wrote code to strip any of those headers being sent on UI requests
Erisa
Erisa9mo ago
It was likely the cf-connecting-ip header
mr nooli
mr nooli9mo ago
Hey, I've got a next-on-pages project, and I'm running into Error 1101 and the CF dashboard is showing:
"exceptions": [
{
"name": "Error",
"message": "The script will never generate a response.",
"timestamp": 1711296914762
}
],
"exceptions": [
{
"name": "Error",
"message": "The script will never generate a response.",
"timestamp": 1711296914762
}
],
How do I go about debugging this? As I can run this locally with npm run dev (idk if npx wrangler dev is the right command, if so I'm running into a bunch of 500 errors that I really can't figure out)
Want results from more Discord servers?
Add your server