chore: log server rendering failures
CI / runtime-diagnostics (push) Skipped
CI / check (push) Successful in 27s
CI / release (push) Skipped
CI / deploy (push) Successful in 44s

This commit is contained in:
Simo committed 2026-08-31 21:26:29 +02:00
1 parent 9a0b6e091a
commit 5f7875ff18
1 file changed
+22
+22
View File
@@ -0,0 +1,22 @@
import type { Instrumentation } from "next";
export const onRequestError: Instrumentation.onRequestError = async (
error,
request,
context,
) => {
if (process.env.NEXT_RUNTIME !== "nodejs") return;
const { logServerError } = await import("@/lib/server-log");
logServerError("next.request_failed", error, {
path: request.path.split("?", 1)[0] ?? request.path,
method: request.method,
routePath: context.routePath,
routeType: context.routeType,
renderSource: context.renderSource,
digest:
typeof error === "object" && error !== null && "digest" in error
? String(error.digest)
: null,
});
};