NeonN
Neon2y ago
12 replies
spotty-amber

Issue with neondatabase/wsproxy for local development.

Hi, I'm running into this error using the neon http driver with the docker image. I followed this guide: https://gal.hagever.com/posts/running-vercel-postgres-locally

NeonDbError: Error connecting to database: Failed to parse URL from https://api.0.0.0/sql

Here is the code
import { neon, Pool, neonConfig } from '@neondatabase/serverless';
import ws from 'ws';

neonConfig.webSocketConstructor = ws; 
if (!process.env.VERCEL_ENV) {
    neonConfig.wsProxy = (host) => `${host}:5433/v1`;
    neonConfig.useSecureWebSocket = false;
    neonConfig.pipelineTLS = false;
    neonConfig.pipelineConnect = false;
    neonConfig.forceDisablePgSSL = true;
}
  
// const pool = new Pool({ connectionString: "postgres://postgres:postgres@0.0.0.0:5433/postgres" });
const sql = neon("postgres://postgres:postgres@0.0.0.0:5433/postgres");


async function main() {
    const result = await sql`SELECT 1 + 1 AS solution`;
    // const result = await pool.query(`SELECT 1 + 1 AS solution`);
    console.log(result);
    process.exit(0)
}

main()
Was this page helpful?