cloudflare / cloudflare/vinext
Dev server crashes on Workers: console.createTask exists but throws; React dev builds call it in every environment
- Dominant language
- TypeScript
- Stars
- 8.8k
- Forks
- 406
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 120
Description
**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`:
1. The RSC environment dies at module initialization — React's dev build calls `console.createTask(...)` at module init (scheduler task tracing)
2. 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)**
```ts
// imported before vinext/server/fetch-handler
(console as any).createTask ??= (name: string) => ({ name, run: (fn: any) => fn() });
```
Fixed by #3233.
Contributor guide
Research direction
The issue says #3233 fixes this; inspect that change first, then trace the vinext/server/fetch-handler entry point and how it reaches each Vite environment. Verify the done condition with vinext dev using the workerd runner, confirming App Router routes no longer return 500s during both RSC initialization and SSR HTML rendering.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- next.js, react, typescript, vite
- Domain
- backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100