Error running npm run preview with OpenNext + Cloudflare (setNextjsServerWorkingDirectory failure)
Hi, I’m trying to run my Next.js app with OpenNext + Cloudflare preview (npm run preview), but I’m hitting a runtime error.
Environment:
Next.js: [^14.0.4]
Node.js: [v22.12.0]
Wrangler: 4.38.0
@opennextjs/cloudflare: ^1.8.3
OS: macOS
Steps I followed from here: https://opennext.js.org/cloudflare/get-started#existing-nextjs-apps
Error shown:
What I checked:
-
- Running from project root.
Tried cleaning .open-next and rebuilding but got same error.
Question:
- Is this a known issue with OpenNext on Wrangler preview?
- Why would
Any workaround to make the local server run successfully ?
#workers-help
Environment:
Next.js: [^14.0.4]
Node.js: [v22.12.0]
Wrangler: 4.38.0
@opennextjs/cloudflare: ^1.8.3
OS: macOS
Steps I followed from here: https://opennext.js.org/cloudflare/get-started#existing-nextjs-apps
Error shown:
What I checked:
-
.open-next/server-functions/default/ exists and contains handler.mjs, , .next/, etc.- Running from project root.
Tried cleaning .open-next and rebuilding but got same error.
Question:
- Is this a known issue with OpenNext on Wrangler preview?
- Why would
setNextjsServerWorkingDirectory fail even though the folder and files exist?Any workaround to make the local server run successfully ?
#workers-help

