Deploy NexJS Site to CloudFlare Pages with Wrangler

Hi I have a monorepo setup (nx). Because monorepo is not supported by CloudFlare Pages, I would like to deploy the build folder manually using wrangler. npx wrangler pages deploy ./apps/app-nam --project-name mono-test-01 This folder includes the ./next/ output folder, as well as a package.json file, with a script, "start", being npx next start This uploads the files, but the link shows a 404. Any advice, how can I get the .next folder to run?
6 Replies
Hello, I’m Allie!
Try npx wrangler pages deploy ./apps/app-nam/.next/output --project-name mono-test-01, or whatever the output folder is named
simmbiote
simmbiote3mo ago
Hmm no /output/ folder. The site also uses SSR features (not static).
No description
Hello, I’m Allie!
Are you using next-on-pages?
simmbiote
simmbiote3mo ago
Haven't got next-on-pages working fully with nx yet, but I managed to do it on a test app, by removing nx from the next.config.js file npx @cloudflare/next-on-pages@1 This now builds successfully, having remvoed nx from next.config.js I now need to upload "direct upload" using wrangler: npx wrangler pages deploy . --project-name mono-test-01 The files get uploaded (see screenshot). But since it is Direct Upload (not Git connected), seems that CloudFlare does not know to run it as a next app. It can't be git connected, because it's a monorepo. Any ideas?
No description
Hello, I’m Allie!
You want to deploy .vercel/output/static
simmbiote
simmbiote3mo ago
Interestingly that now shows an error page at least. Node.JS Compatibility Error
I added nodejs_compat compatibility and will now redeploy 🤞 Thanks @HardlyWorkin' that worked for my simple Nextjs app, will now try with a more advanced app in the repo, which has SSR, etc.
Want results from more Discord servers?
Add your server
More Posts
Worker - Streaming : it takes quite a long time for the client to get the first data: is it normal ?I am following the example in the documentation: https://developers.cloudflare.com/workers-ai/modelsCloudflare Next-On-Pages crash on DockerHi guys, i'm unable to make Cloudflare next-on-pages work on development using Docker. When i run tAccount locked unpaid invoices**Unable to upgrade plan** even after clearing all pending dues **error code :- 1323 ticket number:-Mailchannels only for one page?I could swear I read that the mailchannels post capture can be limited somehow when I first set thatI can't access to websites which has cloudfare captcha verificationThe issue start about a day ago, i'm accessing dexscreener.com . The Cloudfare captcha suddenly failMQTT over websocketHi, I'm trying to setup an MQTT broker on my raspberry Pi. I already have a tunnel setup for a websiCloudflare DNS 522 error when pointing at Cloudflare PagesHello. I have an issue where when I deploy cloudflare pages, the site loads fine on the .dev page, bWAF Access Rules based on VPNIs it possible to create a WAF access rule for my web app that would prohibit user access via a proxCloud Access Security Broker (CASB) and Cloud Security Posture Management (CSPM) on cloudflare?Are there any solutions on cloudflare for the same? I am looking for these to implement in my organiTLS Issue - Workers to AWS IoT CoreI am trying to communicate to the AWS IoT core HTTPS endpoint through a cloudflare worker (using hon