Spaces:
Runtime error
Runtime error
Download test-db.js from damndeepesh-dev/RippleWorkers: direct link, hf CLI and curl.
- Browser
- Download file 734 Bytes
-
https://huggingface.co/spaces/damndeepesh-dev/RippleWorkers/resolve/main/test-db.js
- Command line
-
hf download hf://spaces/damndeepesh-dev/RippleWorkers/test-db.js
-
curl -L -o test-db.js https://huggingface.co/spaces/damndeepesh-dev/RippleWorkers/resolve/main/test-db.js
734 Bytes
| const { Client } = require('pg'); | |
| const dotenv = require('dotenv'); | |
| dotenv.config(); | |
| console.log("Testing connection to:", process.env.DATABASE_URL.replace(/:[^:@]*@/, ':****@')); // masking password | |
| const client = new Client({ | |
| connectionString: process.env.DATABASE_URL, | |
| ssl: { rejectUnauthorized: false } // Required for Supabase/Neon usually | |
| }); | |
| async function test() { | |
| try { | |
| console.log("Connecting..."); | |
| await client.connect(); | |
| console.log("Connected successfully!"); | |
| const res = await client.query('SELECT NOW()'); | |
| console.log("Query result:", res.rows[0]); | |
| await client.end(); | |
| } catch (err) { | |
| console.error("Connection failed:", err); | |
| } | |
| } | |
| test(); | |