这是indexloc提供的服务,不要输入任何密码
Skip to content

[Turbopack Nextjs 16]: Pino - Cannot find module './transport-stream' #86099

@CHC383

Description

@CHC383

Link to the code that reproduces this issue

https://github.com/CHC383/nextjs-turbopack-pino-reproduction

To Reproduce

  1. Deploy the code to Vercel
  2. Visit /api/log
  3. 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 './transport-stream'
Require stack:
- /var/task/node_modules/.pnpm/pino@10.1.0/node_modules/pino/lib/worker.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1383:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1025:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1030:22)
    at Module._load (node:internal/modules/cjs/loader:1192:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:237:24)
    at Module.require (node:internal/modules/cjs/loader:1463:12)
    at require (node:internal/modules/helpers:147:16)
    at Object.<anonymous> (/var/task/node_modules/.pnpm/pino@10.1.0/node_modules/pino/lib/worker.js:7:36)
    at Module._compile (node:internal/modules/cjs/loader:1706:14)

Expected behavior

Pino worker thread works without any exception, which is the behavior of using
WebPack.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #84-Ubuntu SMP PREEMPT_DYNAMIC Fri Sep  5 22:36:38 UTC 2025
  Available memory (MB): 15839
  Available CPU cores: 20
Binaries:
  Node: 22.21.1
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.20.0
Relevant Packages:
  next: 16.0.3 // Latest available version is detected (16.0.3).
  eslint-config-next: N/A
  react: 19.2.0
  react-dom: 19.2.0
  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)

Vercel (Deployed)

Additional context

@mischnic This is a follow up of #84766. It seems that with multiple targets, the pino/lib/worker.js is used and not traced by Turbopack properly. I have updated the reproduction code to trigger the new error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    TurbopackRelated to Turbopack with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions