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> = {};
|
const results: Record<string, string> = {};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Test without using DATABASE_URL directly
|
|
||||||
const { default: postgres } = await import("postgres");
|
|
||||||
|
|
||||||
const connectionString = process.env.DATABASE_URL || "";
|
const connectionString = process.env.DATABASE_URL || "";
|
||||||
results["env_exists"] = connectionString ? "yes" : "no";
|
results["env_exists"] = connectionString ? "yes" : "no";
|
||||||
results["env_value"] = connectionString;
|
|
||||||
|
|
||||||
// Try connection
|
|
||||||
if (connectionString) {
|
if (connectionString) {
|
||||||
|
const { default: postgres } = await import("postgres");
|
||||||
const client = postgres(connectionString);
|
const client = postgres(connectionString);
|
||||||
await client.connect();
|
|
||||||
results["connect"] = "success";
|
|
||||||
|
|
||||||
const result = await client`SELECT version()`;
|
const result = await client`SELECT version()`;
|
||||||
|
results["connect"] = "success";
|
||||||
results["version"] = result[0]?.version?.slice(0, 50) || "ok";
|
results["version"] = result[0]?.version?.slice(0, 50) || "ok";
|
||||||
|
|
||||||
await client.end();
|
await client.end();
|
||||||
}
|
}
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue