/** * Next.js server-side instrumentation hook. * * Registered once per Node process at startup (see Next.js docs on * instrumentation.ts). The actual Node-only work lives in * `./instrumentation-node.ts`, loaded via dynamic `import()` so that the * Edge Runtime static analyser does not see `process.on` and flag it as an * unsupported Node.js API. * * The listeners only log third-party async errors (ali-oss + urllib@2 can * emit EventEmitter callbacks after a response has already been returned to * the client); they never swallow errors or mutate response state. */ export async function register(): Promise { if (process.env.NEXT_RUNTIME !== "nodejs") return; const mod = await import("./instrumentation-node"); mod.installNodeProcessListeners(); }