Previously /api/health did deep dependency probes (postgres + redis + minio) and 503'd on any failure. That's readiness behavior, not liveness — a transient Redis/MinIO blip would tell the orchestrator to restart the pod when it should only be dropped from the load balancer. Make /api/health a thin liveness check (returns 200 unconditionally if the process is responding) and move the deep checks to a new /api/ready endpoint with the canonical Kubernetes-style 200/503 contract. Docker-compose healthchecks keep pointing at /api/health, which is now more conservative (no false-positive container restarts). Documenso/SMTP are intentionally not probed in /api/ready: each tenant configures its own credentials and a tenant misconfiguration shouldn't deadline the entire shared CRM. Also tighten the gdpr-bundle-builder casts: replace the scattered `as unknown as Record<string, unknown>` double-casts with a small `toJsonRow<T>()` helper that does the widen narrow→wide in one place with one cast hop instead of two. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
16 lines
595 B
TypeScript
16 lines
595 B
TypeScript
import { NextResponse } from 'next/server';
|
|
|
|
/**
|
|
* Liveness probe — confirms the Next.js process is responding.
|
|
*
|
|
* Returns 200 unconditionally; if the process is wedged or has crashed
|
|
* the request never lands here at all. Do NOT include database/Redis/MinIO
|
|
* checks in this endpoint — a transient downstream blip should drop the
|
|
* pod from the load balancer (readiness), not restart the pod (liveness).
|
|
*
|
|
* For deep dependency checks, hit `/api/ready` instead.
|
|
*/
|
|
export async function GET() {
|
|
return NextResponse.json({ status: 'ok', timestamp: new Date().toISOString() });
|
|
}
|