fix: debug route
This commit is contained in:
parent
f7bcc97666
commit
affd70b9a7
1 changed files with 2 additions and 9 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue