vercel / next.js

The React Framework

Home Page:https://nextjs.org

Repository from Github https://github.comvercel/next.jsRepository from Github https://github.comvercel/next.js

build failed with instrumentation

magicsong opened this issue · comments

Link to the code that reproduces this issue

https://github.com/magicsong/me

To Reproduce

following https://docs.lmnr.ai/tracing/integrations/vercel-ai-sdk to add an instrumentation
my instrumentation.ts:

export async function register() {
    // prevent this from running in the edge runtime
    if (process.env.NEXT_RUNTIME === 'nodejs') {
      const { Laminar } = await import('@lmnr-ai/lmnr');
      Laminar.initialize({
        projectApiKey: process.env.LMNR_API_KEY,
      });
    }
  }

Current vs. Expected behavior

current error: TypeError: The worker script or module filename must be an absolute path or a relative path starting with './' or '../'. Received "[project]/node_modules/.pnpm/thread-stream@3.1.0/node_modules/thread-stream/index.js [instrumentation-edge] (ecmascript)/lib/worker.js"

the [instrumentation-edge] is wired, it was supposed to be nodejs

Provide environment information

/bin/sh: yarn: command not found

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:24 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6030
  Available memory (MB): 36864
  Available CPU cores: 12
Binaries:
  Node: 23.10.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: 10.6.3
Relevant Packages:
  next: 15.2.3 // There is a newer version (15.2.4) available, upgrade recommended! 
  eslint-config-next: N/A
  react: 19.0.0
  react-dom: 19.0.0
  typescript: 5.7.2
Next.js Config:
  output: standalone

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

Instrumentation

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

next dev (local)

Additional context

No response