For Workers & Pages, what is the name of the domain?
What is the error message?
[ERROR] A request to the Cloudflare API (/accounts/20ad67f84a09f9c8031b6108/workers/scripts/versions) failed. Uncaught ReferenceError: MessageChannel is not defined
What is the issue or error you’re encountering
Deploying an astro site that uses worker static assets and it is failing to deploy.
What steps have you taken to resolve the issue?
I tried reverting to previous commit but the build is still failing.
What are the steps to reproduce the issue?
Just deploying from pushing from github and letting CF build and deploy.
This is a bug that should be fixed before long (there is an open Github issue).
In the meantime add this to your astro.config.js:
vite: {
resolve: {
// Use react-dom/server.edge instead of react-dom/server.browser for React 19.
// Without this, MessageChannel from node:worker_threads needs to be polyfilled.
alias: import.meta.env.PROD && {
'react-dom/server': 'react-dom/server.edge',
},
},
},
(If you already have a vite section, add that resolve section to it.)