// Runtime-agnostic entry. Node 전용 로직은 instrumentation-node.ts 로 분리해
// Edge 런타임 정적 분석에서 Node API 경고가 뜨지 않도록 함.
import type { Instrumentation } from "next";

export async function register() {
  if (process.env.NEXT_RUNTIME !== "nodejs") return;
  const mod = await import("./instrumentation-node");
  mod.registerNode();
}

export const onRequestError: Instrumentation.onRequestError = async (err, request, context) => {
  if (process.env.NEXT_RUNTIME !== "nodejs") return;
  const mod = await import("./instrumentation-node");
  await mod.onRequestErrorNode(err, request, context);
};
