NeonN
Neon2y ago
2 replies
living-lavender

Local development and CI

For local development and CI how do you connect with websockets?

Here is my docker-compose.yaml
version: "3.4"
services:
  postgres:
    image: postgres
    environment:
      POSTGRES_DB: testdb
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: password
    ports:
      - 5432:5432
    volumes:
      - "${PWD}/dev-data/postgres:/var/lib/postgresql/data"
  pg_proxy:
    image: ghcr.io/neondatabase/wsproxy:latest
    environment:
      APPEND_PORT: "postgres:5432"
      ALLOW_ADDR_REGEX: ".*"
      LOG_TRAFFIC: "true"
    ports:
      - 5433:80
      - 2112:2112
    depends_on:
      - postgres


and here is my drizzle orm connection logic

import { Pool } from "@neondatabase/serverless";
import { drizzle } from "drizzle-orm/neon-serverless";


const pool = new Pool({ connectionString: process.env.DATABASE_URL });

export const db = drizzle(pool);


I'm unable to connect and I get the following error:

Error: All attempts to open a WebSocket to connect to the database failed. Please refer to https://github.com/neondatabase/serverless/blob/main/CONFIG.md#websocketconstructor-typeof-websocket--undefined. Details: fetch failed
Was this page helpful?