vercel / vercel/next.js

Windows: next build (webpack) crashes in createActionAssets — serverActionModules is empty while serverActions has workers

Open
#96,823 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Server Actions
Dominant language
JavaScript
Stars
142k
Forks
32.4k
Avg merge
2d 14h
Merged PRs (30d)
351

Description

Link to the code that reproduces this issue

https://github.com/hurttlocker/o8

To Reproduce
  1. On Windows (reproduced on stock GitHub windows-latest), run next build (webpack production build, not Turbopack) on an App Router app that contains no first-party Server Actions but depends on a package that registers actions (in our case @clerk/nextjs keyless mode).
  2. The build compiles all routes, then crashes in processAssets.

The identical commit builds green on macOS and Linux.

Failing public CI run (before we patched around it): https://github.com/hurttlocker/o8/actions/runs/31070784414
Investigation issue with full notes: https://github.com/hurttlocker/o8/issues/1745

Current vs. Expected behavior

Current: next build dies with:

TypeError: Cannot read properties of undefined (reading 'client')
    at FlightClientEntryPlugin.createActionAssets (…/next/dist/build/webpack/plugins/flight-client-entry-plugin.js)

In createActionAssets, this line assumes every action worker name resolves in the module map:

const modId = pluginState.serverActionModules[name][layer[name] === WEBPACK_LAYERS.actionBrowser ? 'client' : 'server'];

We instrumented the lookup miss on the failing runner and found pluginState.serverActionModules is entirely empty ({}) at createActionAssets time on Windows, while pluginState.serverActions[id].workers is populated with normal-looking keys (no path-separator weirdness — we printed and checked both stylings). So this is not a \\ vs / key mismatch; the populate side (the traverseModules pass that fills serverActionModules) never fires, or is keyed into a different plugin-state instance, on Windows only.

Expected: either the map is populated symmetrically with serverActions (as it is on macOS/Linux), or the manifest assembly tolerates a miss instead of crashing the whole build on a property read of undefined.

Provide environment information
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows Server 2022 (GitHub windows-latest)
Binaries:
  Node: 22.x
  npm: 10.x
Relevant Packages:
  next: 16.2.11
  react: 19.x
  typescript: 5.x
Next.js Config:
  output: standalone (webpack build; Turbopack not used)
Which area(s) are affected? (Select all that apply)

Server Actions

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

We currently ship a patch-package workaround that warn+skips the unresolvable worker entry at both the server and edge lookup sites — safe for us only because the app has zero first-party actions. The failure is 100% reproducible on our public Windows CI and 0% on darwin/linux, so we are happy to test candidate fixes there.

Not yet verified against canary — the repro needs a Windows runner; nothing in canary's changelog for this file suggests the populate-side behavior changed.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in flight-client-entry-plugin.js at createActionAssets and trace the traverseModules pass that should populate serverActionModules. Run the linked next build reproduction on a Windows runner, comparing plugin state with macOS or Linux. Done means the map is populated symmetrically or manifest assembly handles a missing worker without crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nextjs, webpack
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.