-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Closed
Copy link
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.linear: turbopackConfirmed issue that is tracked by the Turbopack team.Confirmed issue that is tracked by the Turbopack team.
Description
Link to the code that reproduces this issue
https://github.com/CHC383/nextjs-turbopack-pino-reproduction
To Reproduce
- Deploy the code to Vercel
- Visit
<url>/api/log - Check the log of the Vercel deployment
Current vs. Expected behavior
Current behavior
With Turbopack in NextJs v16, Pino worker thread throws the following error:
Uncaught Exception: Error: Cannot find module 'real-require'
Require stack:
- /var/task/node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/lib/worker.js
at Module._resolveFilename (node:internal/modules/cjs/loader:1365:15)
at defaultResolveImpl (node:internal/modules/cjs/loader:1021:19)
at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1026:22)
at Module._load (node:internal/modules/cjs/loader:1175:37)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
at Module.require (node:internal/modules/cjs/loader:1445:12)
at require (node:internal/modules/helpers:135:16)
at Object.<anonymous> (/var/task/node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/lib/worker.js:3:37)
at Module._compile (node:internal/modules/cjs/loader:1688:14)
Expected behavior
Pino worker thread works without any exception, which is the behavior of using
WebPack in NextJs v15.
Provide environment information
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 25.0.0: Wed Sep 17 21:41:45 PDT 2025; root:xnu-12377.1.9~141/RELEASE_ARM64_T6000
Available memory (MB): 16384
Available CPU cores: 10
Binaries:
Node: 22.20.0
npm: 10.9.3
Yarn: 1.22.22
pnpm: 10.18.1
Relevant Packages:
next: 16.0.0-beta.0 // Latest available version is detected (16.0.0-beta.0).
eslint-config-next: N/A
react: 19.2.0
react-dom: 19.2.0
typescript: 5.9.3
Next.js Config:
output: N/AWhich area(s) are affected? (Select all that apply)
Turbopack
Which stage(s) are affected? (Select all that apply)
Vercel (Deployed)
Additional context
The transport target pino-pretty in the reproduction repository is just for demo purpose, the same issue happens on any of the targets.
Pino uses thread-stream to send the logs to worker thread when logging asynchronously, which uses real-require to work with webpack import. Looks like Turbopack doesn't bundlereal-require properly.
lagomcoder, elevchyt, josiahwiebe, jtwozniak, ImBIOS and 2 more
Metadata
Metadata
Assignees
Labels
TurbopackRelated to Turbopack with Next.js.Related to Turbopack with Next.js.linear: turbopackConfirmed issue that is tracked by the Turbopack team.Confirmed issue that is tracked by the Turbopack team.