Merge pull request #115 from trails-cool/fix-planner-health

Fix Planner health check DB connection
This commit is contained in:
Ullrich Schäfer 2026-03-27 20:58:22 +01:00 committed by GitHub
commit 3180017f16
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -75,9 +75,10 @@ const version = process.env.SENTRY_RELEASE ?? "dev";
async function handleHealth(_req: IncomingMessage, res: ServerResponse): Promise<void> {
try {
const { withDb, db } = await import("@trails-cool/db");
const { createDb } = await import("@trails-cool/db");
const { sql } = await import("drizzle-orm");
await withDb(async () => { await db.execute(sql`SELECT 1`); });
const db = createDb();
await db.execute(sql`SELECT 1`);
res.writeHead(200, { "Content-Type": "application/json" });
res.end(JSON.stringify({ status: "ok", version, db: "connected" }));
} catch {