Files
EpicNext-Cms/src/instrumentation.ts
T
Simo 2619bec165
CI / check (push) Successful in 1m30s
CI / deploy (push) Successful in 1m26s
CI / e2e (push) Successful in 25s
feat(catalog): queue furniture imports with history and matching file attachments
2026-09-05 17:02:26 +02:00

38 lines
960 B
TypeScript

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,
});
};
export async function register() {
if (
process.env.NEXT_RUNTIME !== "nodejs" ||
process.env.NEXT_PHASE === "phase-production-build"
)
return;
const { drainFurnitureImports } = await import(
"@/lib/services/furni-job-worker"
);
const timer = setInterval(() => {
void drainFurnitureImports();
}, 30000);
timer.unref();
}