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:
parent
9187c3ce2b
commit
7fdbd4cddf
1 changed files with 3 additions and 2 deletions
|
|
@ -75,9 +75,10 @@ const version = process.env.SENTRY_RELEASE ?? "dev";
|
||||||
|
|
||||||
async function handleHealth(_req: IncomingMessage, res: ServerResponse): Promise<void> {
|
async function handleHealth(_req: IncomingMessage, res: ServerResponse): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const { withDb, db } = await import("@trails-cool/db");
|
const { createDb } = await import("@trails-cool/db");
|
||||||
const { sql } = await import("drizzle-orm");
|
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.writeHead(200, { "Content-Type": "application/json" });
|
||||||
res.end(JSON.stringify({ status: "ok", version, db: "connected" }));
|
res.end(JSON.stringify({ status: "ok", version, db: "connected" }));
|
||||||
} catch {
|
} catch {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue