Context
Running an App Router app in dev on the Cloudflare runtime (vinext dev with the workerd runner).
Observed
Every route 500s. Two distinct crashes, both rooted in console.createTask:
- The RSC environment dies at module initialization — React's dev build calls
console.createTask(...) at module init (scheduler task tracing)
- The SSR child environment dies again during HTML rendering for the same reason
workerd's console exposes createTask but throws "not implemented" when it is actually called, so React's feature detection happily picks it up and then crashes on first use. A stub imported before the vinext handler fixes the RSC environment, but the SSR environment needs the polyfill too — the fix has to reach every vite environment.
Expected
Dev rendering should work on Workers out of the box; the runtime gap should be shimmed once, upstream, for all server environments.
Workaround (app-side)
// imported before vinext/server/fetch-handler
(console as any).createTask ??= (name: string) => ({ name, run: (fn: any) => fn() });
Fixed by #3233.
Context
Running an App Router app in dev on the Cloudflare runtime (
vinext devwith the workerd runner).Observed
Every route 500s. Two distinct crashes, both rooted in
console.createTask:console.createTask(...)at module init (scheduler task tracing)workerd's console exposes
createTaskbut throws "not implemented" when it is actually called, so React's feature detection happily picks it up and then crashes on first use. A stub imported before the vinext handler fixes the RSC environment, but the SSR environment needs the polyfill too — the fix has to reach every vite environment.Expected
Dev rendering should work on Workers out of the box; the runtime gap should be shimmed once, upstream, for all server environments.
Workaround (app-side)
Fixed by #3233.