fix: debug route

This commit is contained in:
Manohar Gupta 2026-05-10 04:55:31 +05:30
parent f7bcc97666
commit affd70b9a7

View file

@ -4,22 +4,15 @@ export async function GET() {
const results: Record<string, string> = {};
try {
// Test without using DATABASE_URL directly
const { default: postgres } = await import("postgres");
const connectionString = process.env.DATABASE_URL || "";
results["env_exists"] = connectionString ? "yes" : "no";
results["env_value"] = connectionString;
// Try connection
if (connectionString) {
const { default: postgres } = await import("postgres");
const client = postgres(connectionString);
await client.connect();
results["connect"] = "success";
const result = await client`SELECT version()`;
results["connect"] = "success";
results["version"] = result[0]?.version?.slice(0, 50) || "ok";
await client.end();
}
} catch (err: any) {