nextjs - 💡(How to fix) Fix deploymentId: "" breaks Turbopack hydration in next dev [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#92855Fetched 2026-04-17 08:21:41
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×2closed ×1commented ×1locked ×1

Error Message

Internal Next.js error: Router action dispatched before initialization.

Fix Action

Fix / Workaround

Current behavior:

  • The page renders server-side, but client interactivity never hydrates.
  • Clicking the client button does nothing.
  • In a more complex app, sidebar toggles, dropdowns, and other client interactions were inert.
  • When a component triggered a server action on mount, I also saw: Internal Next.js error: Router action dispatched before initialization.

Code Example

git clone https://github.com/bragagia/next-deploymentid-empty-string-repro.git
cd next-deploymentid-empty-string-repro
npm install

---

npm run dev

---

Operating System:
  Darwin arm64
  macOS 26.3

Node.js version:
  v22.22.2

npm version:
  10.9.7

Next.js version:
  16.1.6

React version:
  19.2.3

react-dom version:
  19.2.3

---

deploymentId: process.env.GITHUB_SHA ?? ""

---

deploymentId:
  process.env.GITHUB_SHA && process.env.GITHUB_SHA !== ""
    ? process.env.GITHUB_SHA
    : undefined
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/bragagia/next-deploymentid-empty-string-repro

This is a minimal public App Router repro for the issue.

The same app works if:

  • deploymentId is removed
  • or deploymentId is undefined
  • or dev is run with next dev --webpack

To Reproduce

  1. Clone the repro repo:
git clone https://github.com/bragagia/next-deploymentid-empty-string-repro.git
cd next-deploymentid-empty-string-repro
npm install
  1. Run the Turbopack dev server:
npm run dev
  1. Open http://localhost:3000.
  2. Click the Count: 0 button.

Current vs. Expected behavior

Current behavior:

  • The page renders server-side, but client interactivity never hydrates.
  • Clicking the client button does nothing.
  • In a more complex app, sidebar toggles, dropdowns, and other client interactions were inert.
  • When a component triggered a server action on mount, I also saw: Internal Next.js error: Router action dispatched before initialization.

Expected behavior:

  • deploymentId: "" should either behave like "unset" or at least not break hydration.
  • Client components should hydrate normally under Turbopack dev.

Provide environment information

Operating System:
  Darwin arm64
  macOS 26.3

Node.js version:
  v22.22.2

npm version:
  10.9.7

Next.js version:
  16.1.6

React version:
  19.2.3

react-dom version:
  19.2.3

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

Turbopack App Router Dev server Configuration

Additional context

I verified the repro locally before publishing it:

  • npm run dev leaves the button inert under Turbopack dev
  • npm run dev:webpack increments the same button normally

The breaking condition was specifically that deploymentId resolved to the empty string.

For example, this broke hydration:

deploymentId: process.env.GITHUB_SHA ?? ""

This did not break hydration:

deploymentId:
  process.env.GITHUB_SHA && process.env.GITHUB_SHA !== ""
    ? process.env.GITHUB_SHA
    : undefined

In the same project, next dev --webpack worked normally, so this appears Turbopack-specific.

extent analysis

TL;DR

  • Setting deploymentId to undefined instead of an empty string may resolve the hydration issue with Turbopack.

Guidance

  • Verify that the issue is indeed caused by deploymentId being an empty string by testing with deploymentId set to undefined or removed.
  • Check if the problem persists when using next dev --webpack, as the issue seems to be specific to Turbopack.
  • Consider modifying the deploymentId assignment to handle the case where process.env.GITHUB_SHA is an empty string, similar to the working example provided.
  • Test the fix by running npm run dev and checking if client interactivity is restored.

Example

deploymentId:
  process.env.GITHUB_SHA && process.env.GITHUB_SHA !== ""
    ? process.env.GITHUB_SHA
    : undefined

Notes

  • The issue appears to be specific to Turbopack, as next dev --webpack works normally.
  • The provided example code snippet may serve as a workaround, but the root cause of the issue may require further investigation.

Recommendation

  • Apply workaround: Setting deploymentId to undefined when it would otherwise be an empty string may resolve the issue, as shown in the provided example code snippet.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix deploymentId: "" breaks Turbopack hydration in next dev [1 comments, 2 participants]