- ensureSuperTokensBackend moved to the health route handler; the dynamic imports in exclusions and alerts dragged recipes into the client build
30 lines
916 B
TypeScript
30 lines
916 B
TypeScript
import { createFileRoute } from "@tanstack/react-router";
|
|
import { ensureTelemetryScheduler } from "@/lib/telemetry/scheduler.server";
|
|
import { getHealthSnapshot } from "@/lib/telemetry/health.server";
|
|
import { ensureSuperTokensBackend } from "@/lib/supertokens/server";
|
|
|
|
export const Route = createFileRoute("/api/health")({
|
|
server: {
|
|
handlers: {
|
|
GET: async () => {
|
|
ensureSuperTokensBackend();
|
|
ensureTelemetryScheduler();
|
|
const snapshot = await getHealthSnapshot();
|
|
|
|
// Always 200: a dependency outage must not fail the k8s probes.
|
|
return new Response(
|
|
JSON.stringify({
|
|
status: snapshot.status,
|
|
checks: snapshot.checks,
|
|
timestamp: new Date().toISOString(),
|
|
}),
|
|
{
|
|
status: 200,
|
|
headers: { "Content-Type": "application/json" },
|
|
}
|
|
);
|
|
},
|
|
},
|
|
},
|
|
});
|