Significant TTFB delay on Cloudflare Worker vs Vercel using same OpenNext setup

I'm using OpenNext to deploy a Next.js 15.3 site with ISR and streaming enabled. When deployed to: Vercel: the initial document load (document in Network tab) is ~389ms Cloudflare Workers: same route takes ~6.3s for the initial document response Both environments use the exact same codebase, and both are rendering an ISR page (non-cached). The rest of the assets load quickly in both cases. Only the HTML response (document) is delayed on Cloudflare.
No description
No description
1 Reply
Leo Cavalcante
Leo CavalcanteOP6mo ago
Turns out the issue is with both the firebase and firebase-admin SDKs , which uses new Function() internally, something disallowed in Cloudflare Workers' V8 sandbox. This causes server components or loaders to silently hang, leading to delayed or canceled HTML responses. Vercel works fine since it runs on Node.js, where dynamic code execution is allowed. To fix it, avoid importing @firebase/firestore in any Worker-executed code... use the Firestore REST API or proxy through an external API route instead.

Did you find this page helpful?