Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
Turbopack enabled apps fail to hydrate with a JS runtime error on Pale Moon browser | GoodFirstPicks

Turbopack enabled apps fail to hydrate with a JS runtime error on Pale Moon browser

vercel/next.js 6 comments 15d ago
View on GitHub
mediumopenScope: somewhat clearSkill match: maybeNext.jsTypeScriptReact

Why this is a good first issue

Browser-specific hydration failure due to turbopack runtime assumptions.

AI Summary

The issue involves turbopack-enabled Next.js apps failing to hydrate on the Pale Moon browser due to a runtime error related to `document.currentScript`. The problem is specific to turbopack's assumptions about browser behavior. Fixing this requires understanding turbopack's runtime and browser compatibility nuances.

Issue Description

Link to the code that reproduces this issue

https://github.com/meltuhamy/nextjspalemoonrepro

To Reproduce

  1. Open any turbopack nextjs app in Palemoon (e.g. https://nextjs.org/ )
  2. Observe whether the app hydrates and has any errors

Current vs. Expected behavior

Expected the app to hydrate without errors. But the app doesn't hydrated because of the turbopack runtime error:

Error: Invariant: Expected document.currentScript to be a <script> element. Received null instead. This is a bug in Next.js.

Provide environment information

npx next info
/bin/sh: yarn: command not found
/bin/sh: pnpm: command not found

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 25.3.0: Wed Jan 28 20:54:46 PST 2026; root:xnu-12377.91.3~2/RELEASE_ARM64_T6000
  Available memory (MB): 65536
  Available CPU cores: 10
Binaries:
  Node: 25.6.1
  npm: 11.9.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.2.0-canary.100 // Latest available version is detected (16.2.0-canary.100).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

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

Turbopack

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

next build (local), next start (local), next dev (local), Vercel (Deployed), Other (Deployed)

Additional context

  • When turbopack is turned off, the issue disappears.
  • Investigating the error, it seems that the turbopack runtime relies on document.currentScript being not null in Promise.then callbacks.

GitHub Labels

Turbopack

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 20 points when you complete it!

Risk Flags

  • browser-specific issue
  • turbopack runtime dependency
Loading labels...

Details

Points20 pts
Difficultymedium
Scopesomewhat clear
Skill Matchmaybe
Test Focusedno
AssigneeicyJoseph