[GH-ISSUE #185] RSC moduleMap undefined on first request: Cannot read properties of undefined (reading 'moduleMap') #41

Open
opened 2026-05-06 12:36:45 +02:00 by BreizhHardware · 2 comments

Originally created by @justinfinnn on GitHub (Feb 28, 2026).
Original GitHub issue: https://github.com/cloudflare/vinext/issues/185

Bug

After a successful vinext deploy, the deployed Worker crashes on every request with:

TypeError: Cannot read properties of undefined (reading 'moduleMap')

HTTP response: 500 error code: 1101 (Worker threw an unhandled exception)

Environment

  • vinext: 0.0.13
  • React: 19.2.0
  • Next.js: 15.2.x
  • Deployment: Cloudflare Workers (via vinext deploy or wrangler deploy --config dist/server/wrangler.json)

Steps to reproduce

  1. vinext build completes successfully
  2. wrangler deploy using the generated dist/server/wrangler.json
  3. Visit the deployed URL — Worker immediately returns 500/1101
  4. The error is Cannot read properties of undefined (reading 'moduleMap') from the RSC layer

Root cause (suspected)

The RSC client manifest / module map is not being correctly initialized or passed between the RSC server layer and the SSR edge environment. The dist/server/ worker attempts to use the module map before it's populated.

Workaround

Use Next.js output: 'export' (static export) and deploy the out/ directory as a static asset Worker:

# wrangler.toml
name = "my-app"
compatibility_date = "2026-02-27"
workers_dev = true

[assets]
directory = "./out"

This bypasses RSC/SSR entirely and works reliably, though it sacrifices server-side rendering.

Expected behavior

The deployed Worker should serve the app successfully without RSC initialization errors.

Originally created by @justinfinnn on GitHub (Feb 28, 2026). Original GitHub issue: https://github.com/cloudflare/vinext/issues/185 ## Bug After a successful `vinext deploy`, the deployed Worker crashes on every request with: ``` TypeError: Cannot read properties of undefined (reading 'moduleMap') ``` HTTP response: `500 error code: 1101` (Worker threw an unhandled exception) ## Environment - vinext: 0.0.13 - React: 19.2.0 - Next.js: 15.2.x - Deployment: Cloudflare Workers (via `vinext deploy` or `wrangler deploy --config dist/server/wrangler.json`) ## Steps to reproduce 1. `vinext build` completes successfully 2. `wrangler deploy` using the generated `dist/server/wrangler.json` 3. Visit the deployed URL — Worker immediately returns 500/1101 4. The error is `Cannot read properties of undefined (reading 'moduleMap')` from the RSC layer ## Root cause (suspected) The RSC client manifest / module map is not being correctly initialized or passed between the RSC server layer and the SSR edge environment. The `dist/server/` worker attempts to use the module map before it's populated. ## Workaround Use Next.js `output: 'export'` (static export) and deploy the `out/` directory as a static asset Worker: ```toml # wrangler.toml name = "my-app" compatibility_date = "2026-02-27" workers_dev = true [assets] directory = "./out" ``` This bypasses RSC/SSR entirely and works reliably, though it sacrifices server-side rendering. ## Expected behavior The deployed Worker should serve the app successfully without RSC initialization errors.
Author
Owner

@StringerBell69 commented on GitHub (Feb 28, 2026):

This appears to be a React version compatibility issue, react-server-dom-webpack requires react@^19.2.4 for RSC support, but you're on react@19.2.0. Try upgrading React with npm install react@latest react-dom@latest and redeploy.

If the issue persists after upgrading, it may be a @vitejs/plugin-rsc or @cloudflare/vite-plugin issue with module map initialization in the Workers runtime, in that case, file a bug on the relevant plugin repo.

<!-- gh-comment-id:3976722743 --> @StringerBell69 commented on GitHub (Feb 28, 2026): This appears to be a React version compatibility issue, react-server-dom-webpack requires react@^19.2.4 for RSC support, but you're on react@19.2.0. Try upgrading React with npm install react@latest react-dom@latest and redeploy. If the issue persists after upgrading, it may be a @vitejs/plugin-rsc or @cloudflare/vite-plugin issue with module map initialization in the Workers runtime, in that case, file a bug on the relevant plugin repo.
Author
Owner

@StringerBell69 commented on GitHub (Feb 28, 2026):

Your repro uses vinext build + wrangler deploy manually, which bypasses the React compatibility checks that vinext deploy performs automatically.

<!-- gh-comment-id:3976762616 --> @StringerBell69 commented on GitHub (Feb 28, 2026): Your repro uses vinext build + wrangler deploy manually, which bypasses the React compatibility checks that vinext deploy performs automatically.
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#41
No description provided.