Spaces:
Running
Running
File size: 666 Bytes
57a1132 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | const { Pool } = require('pg');
require('dotenv').config();
const connectionString = process.env.SUPABASE_DB_URL;
async function test() {
console.log('Testing PG connection string:', connectionString);
const pool = new Pool({
connectionString,
ssl: { rejectUnauthorized: false }
});
try {
const client = await pool.connect();
console.log('✅ PostgreSQL connection successful!');
const res = await client.query('SELECT NOW()');
console.log('Current time from DB:', res.rows[0]);
client.release();
} catch (err) {
console.error('❌ PostgreSQL connection failed:', err.message);
} finally {
pool.end();
}
}
test();
|