pinpoint-node-agent icon indicating copy to clipboard operation
pinpoint-node-agent copied to clipboard

next.js

Open feelform opened this issue 2 years ago • 3 comments

feelform avatar Mar 22 '22 10:03 feelform

+1

Jungley8 avatar May 30 '23 03:05 Jungley8

We confirmed that it is currently tracking properly in the Next.js page directory. What does Next.js do?

kis0421 avatar Nov 16 '23 03:11 kis0421

i think some people faced same issue like me

if you want to set up Pinpoint-Node-Agent,

you should check next.config.js instrumentationHook option

and you just implement pinpoint code at instrumentation.js

// next.config.js
{
   experimental: {
    instrumentationHook: true,
  },
}
// instrumentation.js
export async function register () {
 if(process.env.NEXT_RUNTIME === "nodejs"){
  const Agent = await require("pinpoint-node-agent/lib/agent")
  
  new Agent({
   ...your config
   })
 }
}

kode15333 avatar Aug 12 '24 08:08 kode15333