Fix Planner health check: use createDb instead of non-existent db export

@trails-cool/db doesn't export a db instance — only createDb and withDb.
The health check was importing a non-existent export, always failing.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-03-27 20:58:17 +01:00
parent 9187c3ce2b
commit 7fdbd4cddf
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9

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 {