cloud

Deploying to Cloudflare: A Real Experience with Build Errors

A practical guide on deploying to Cloudflare, dealing with build errors, and handling monorepo deployments

cloudflare
deployment
monorepo
open-next
wrangler
BreathingCode Team
2025-07-04
8 min read

Deploying to Cloudflare: A Real Experience with Build Errors

So the Day was full of the Build errors on the cloudflare. Let me share my experience and what I learned along the way.

Windows Deployment Challenges

Open-next on windows is a tough thing to build and deploy. Here's what you need to know:

  • One must use the WSL at least on windows for deployment
  • wsl users as well cannot deploy from a normal terminal
  • open git bash in administrator mode
  • then build and deploy

Pro tip: It will be easier if you build and deploy from the cloudflare dashboard - figuring out the errors just gets easier there.

Monorepo Deployment Strategy

So the first thing we were confused about was how to deploy a monorepo (like frontend and backend separately).

Here's what we figured out:

  • To deploy separately, have the wrangler.json in the root of the folder you want to deploy
  • For example, for deploying apps/web, have the wrangler.json in the root of the web folder
  • We need to change the root on the cloudflare dashboard before build

Build Configuration

Change the build command as well since it is cloudflare build rather than pnpm build.

Wrangler File Path Issues

This is where it gets interesting with the wrangler file:

  • There was a path error here as well
  • For the "main" and "directory", it was ".open-next/worker.js" only, so it was not able to find out the worker.js file in the root
  • Solution: needed to update path to ./.open-next/worker.js
  • Same goes for the "directory"

Final Success

Now finally, the build was successful and deployed at:

https://eight-pages.0111labs-in.workers.dev/

Side note: AI was not very helpful this time though 😅

Key Takeaways

  1. Use WSL for Windows deployments
  2. Deploy from administrator Git Bash
  3. Configure wrangler.json in the correct root folder
  4. Double-check your path configurations
  5. Consider using Cloudflare dashboard for easier error debugging

Found this helpful?

Share it with others!