an app to share curated trails sidetrail.app
atproto nextjs react rsc

add onRequestError log

+19
+19
instrumentation.ts
··· 1 1 import { registerOTel } from "@vercel/otel"; 2 2 import { PgInstrumentation } from "@opentelemetry/instrumentation-pg"; 3 + import type { Instrumentation } from "next"; 3 4 4 5 export function register() { 5 6 registerOTel({ ··· 7 8 instrumentations: [new PgInstrumentation()], 8 9 }); 9 10 } 11 + 12 + export const onRequestError: Instrumentation.onRequestError = async (err, request, context) => { 13 + const error = err as Error & { digest?: string; cause?: unknown }; 14 + console.error("[onRequestError]", { 15 + error: { 16 + name: error.name, 17 + message: error.message, 18 + digest: error.digest, 19 + cause: error.cause, 20 + stack: error.stack, 21 + }, 22 + request: { 23 + method: request.method, 24 + path: request.path, 25 + }, 26 + context, 27 + }); 28 + };