Skip to content

RSC moduleMap undefined on first request: Cannot read properties of undefined (reading 'moduleMap') #185

@justinfinnn

Description

@justinfinnn

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions