[GH-ISSUE #672] RSC streaming crash: enqueueModel is not a function (multi-route App Router) #144

Open
opened 2026-05-06 12:37:36 +02:00 by BreizhHardware · 1 comment

Originally created by @M1chaelTran on GitHub (Mar 24, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/672

Bug

App Router dev server crashes with chunk.reason.enqueueModel is not a function on all routes when the app has more than 1-2 pages.

Single-page apps work perfectly. Adding sibling routes breaks ALL routes including ones that previously worked.

Environment

  • vinext: 0.0.34
  • vite: 7.3.1
  • react: 19.2.4
  • react-dom: 19.2.4
  • react-server-dom-webpack: 19.2.4
  • @cloudflare/vite-plugin: 1.30.0
  • @vitejs/plugin-rsc: 0.5.21
  • Node.js: 24.6.0
  • macOS Darwin 25.3.0

Reproduction

vite.config.ts (matches examples/app-router-cloudflare):

import { defineConfig } from "vite";
import vinext from "vinext";
import { cloudflare } from "@cloudflare/vite-plugin";

export default defineConfig({
  plugins: [
    vinext(),
    cloudflare({
      viteEnvironment: { name: "rsc", childEnvironments: ["ssr"] },
    }),
  ],
});

Works (single route):

app/
  layout.tsx    # simple html/body
  page.tsx      # <h1>Hello</h1>

GET / returns 200 with rendered HTML

Fails (multiple routes):

app/
  layout.tsx
  page.tsx      # homepage with imports
  about/
    page.tsx    # <h1>About</h1>
  donate/
    page.tsx    # <h1>Donate</h1>

→ ALL routes return 500 with:

chunk.reason.enqueueModel is not a function
  at resolveModelChunk (node_modules/.vite/deps_ssr/react-server-dom-webpack_client__edge.js)
  at processFullBinaryRow
  at progress

Also tested:

  • Dynamic segments [locale] → same error
  • Flat static routes only → same error when >2 routes
  • With/without nested layouts → same error
  • vite-plus 0.1.12 → same error
  • Cleared .vite cache between tests → same error

Expected behavior

Multi-route App Router apps should render all pages without RSC streaming errors.

Additional context

The error is in the SSR dep-optimized version of react-server-dom-webpack_client__edge.js. The resolveModelChunk function at line ~995 calls chunk.reason.enqueueModel() but chunk.reason doesn't have this method when processing RSC payloads for apps with multiple route entries.

Originally created by @M1chaelTran on GitHub (Mar 24, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/672 ## Bug App Router dev server crashes with `chunk.reason.enqueueModel is not a function` on all routes when the app has more than 1-2 pages. Single-page apps work perfectly. Adding sibling routes breaks ALL routes including ones that previously worked. ## Environment - vinext: 0.0.34 - vite: 7.3.1 - react: 19.2.4 - react-dom: 19.2.4 - react-server-dom-webpack: 19.2.4 - @cloudflare/vite-plugin: 1.30.0 - @vitejs/plugin-rsc: 0.5.21 - Node.js: 24.6.0 - macOS Darwin 25.3.0 ## Reproduction **vite.config.ts** (matches examples/app-router-cloudflare): ```ts import { defineConfig } from "vite"; import vinext from "vinext"; import { cloudflare } from "@cloudflare/vite-plugin"; export default defineConfig({ plugins: [ vinext(), cloudflare({ viteEnvironment: { name: "rsc", childEnvironments: ["ssr"] }, }), ], }); ``` ### Works (single route): ``` app/ layout.tsx # simple html/body page.tsx # <h1>Hello</h1> ``` → `GET /` returns 200 with rendered HTML ### Fails (multiple routes): ``` app/ layout.tsx page.tsx # homepage with imports about/ page.tsx # <h1>About</h1> donate/ page.tsx # <h1>Donate</h1> ``` → ALL routes return 500 with: ``` chunk.reason.enqueueModel is not a function at resolveModelChunk (node_modules/.vite/deps_ssr/react-server-dom-webpack_client__edge.js) at processFullBinaryRow at progress ``` ### Also tested: - Dynamic segments `[locale]` → same error - Flat static routes only → same error when >2 routes - With/without nested layouts → same error - vite-plus 0.1.12 → same error - Cleared `.vite` cache between tests → same error ## Expected behavior Multi-route App Router apps should render all pages without RSC streaming errors. ## Additional context The error is in the SSR dep-optimized version of `react-server-dom-webpack_client__edge.js`. The `resolveModelChunk` function at line ~995 calls `chunk.reason.enqueueModel()` but `chunk.reason` doesn't have this method when processing RSC payloads for apps with multiple route entries.
Author
Owner

@southpolesteve commented on GitHub (Mar 25, 2026):

Thanks for the detailed report!

I tried reproducing this pretty closely from what you included in the issue, including the exact version set, but I still haven’t been able to get the chunk.reason.enqueueModel is not a function failure to happen. All the attempts I have tried have worked including with multiple LLM models.

If you’re able to share a small GitHub repo that reproduces it, that would help a lot. Even better would be a repo plus exact run steps. If this is also happening on a deployed app, a live URL or Workers URL would be helpful too.

<!-- gh-comment-id:4122598308 --> @southpolesteve commented on GitHub (Mar 25, 2026): Thanks for the detailed report! I tried reproducing this pretty closely from what you included in the issue, including the exact version set, but I still haven’t been able to get the `chunk.reason.enqueueModel is not a function` failure to happen. All the attempts I have tried have worked including with multiple LLM models. If you’re able to share a small GitHub repo that reproduces it, that would help a lot. Even better would be a repo plus exact run steps. If this is also happening on a deployed app, a live URL or Workers URL would be helpful too.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#144
No description provided.