Add consistent API request logging and a themed 404 page, bump to 0.4.0
CI / Build and push image (push) Successful in 1m10s
CI / Static checks (push) Successful in 1m39s

Every app/api route handler now goes through withRouteLogging, which logs
a correlated reqId/method/path/status/duration for each request and turns
any uncaught error into a logged stack trace plus a clean JSON 500 instead
of Next's default opaque failure. proxy.ts logs rejected auth attempts, and
instrumentation.ts's onRequestError catches anything that still escapes a
route handler. Also adds a minimal not-found page matching the app's card
styling.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-26 08:45:15 +02:00
co-authored by Claude Sonnet 5
parent 5484d3cefe
commit 9e0380ec75
20 changed files with 267 additions and 109 deletions
+10 -6
View File
@@ -1,9 +1,13 @@
import { NextResponse } from "next/server";
import { getSessionTimeline } from "@/lib/db/queries/stats";
import { withRouteLogging } from "@/lib/api/with-route-logging";
export async function GET(req: Request, { params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const bucketMs = Number(new URL(req.url).searchParams.get("bucketMs") ?? 1000);
const timeline = await getSessionTimeline(Number(id), bucketMs);
return NextResponse.json({ timeline });
}
export const GET = withRouteLogging(
"stats.session-timeline",
async (req: Request, { params }: { params: Promise<{ id: string }> }) => {
const { id } = await params;
const bucketMs = Number(new URL(req.url).searchParams.get("bucketMs") ?? 1000);
const timeline = await getSessionTimeline(Number(id), bucketMs);
return NextResponse.json({ timeline });
},
);
+3 -2
View File
@@ -1,7 +1,8 @@
import { NextResponse } from "next/server";
import { getSessionsSummary } from "@/lib/db/queries/stats";
import { withRouteLogging } from "@/lib/api/with-route-logging";
export async function GET() {
export const GET = withRouteLogging("stats.sessions", async () => {
const summary = await getSessionsSummary();
return NextResponse.json(summary);
}
});