React SSR on Cloudflare Workers fails due to missing MessageChannel API

Ran into an interesting issue deploying an Astro site using workers (not pages. instead serving static assets using worker): The React renderer fails with MessageChannel is not defined error when trying to do server-side rendering in Workers.
✘ [ERROR] Deployment failed!

Failed to publish your Function. Got error: Uncaught ReferenceError: MessageChannel is not defined
at renderers.mjs:6530:16 in requireReactDomServer_browser_production
at renderers.mjs:12527:8 in requireServer_browser
at renderers.mjs:12539:29
✘ [ERROR] Deployment failed!

Failed to publish your Function. Got error: Uncaught ReferenceError: MessageChannel is not defined
at renderers.mjs:6530:16 in requireReactDomServer_browser_production
at renderers.mjs:12527:8 in requireServer_browser
at renderers.mjs:12539:29
Has anyone found a clean workaround for this?
2 Replies
Chaika
Chaika2w ago
GitHub
React 19 + Cloudflare Adapter -> "Bug: Uncaught ReferenceError: Mes...
Astro Info Astro v5.1.1 Node v22.6.0 System macOS (arm64) Package Manager bun Output server Adapter @astrojs/cloudflare Integrations @astrojs/mdx @astrojs/sitemap @astrojs/tailwind @astrojs/react I...
GitHub
Runtime APIs: MessageChannel · Issue #3273 · cloudflare/workerd
The MessageChannel API is available on node but not CF Workers. This is causing an issue during the deployment of sites using React 19 + Astro + Workers, see facebook/react#31827 and withastro/astr...
bkyerv
bkyervOP2w ago
Спасибо

Did you find this page helpful?