denodrivers / postgres

PostgreSQL driver for Deno
https://denodrivers.github.io/postgres
MIT License
599 stars 96 forks source link

Unknown response for startup #120

Closed sarthaksavvy closed 3 years ago

sarthaksavvy commented 4 years ago

Getting This Error

error: Uncaught Error: Unknown response for startup: E throw new Error(Unknown response for startup: ${msg.type});

deno 1.0.0 v8 8.4.300 typescript 3.9.2

postgres (PostgreSQL) 12.2

bartlomieju commented 4 years ago

Which version of deno-postgres do you use?

sarthaksavvy commented 4 years ago

I just used it like this

import { Client } from "https://deno.land/x/postgres/mod.ts"; I think this should pull the latest version

hayd commented 4 years ago

I wonder if this can happen if you don't await startup?

could you share some code?

richardgirges commented 4 years ago

I'm running into this as well. Here's my code:

import { Pool } from "https://deno.land/x/postgres@v0.4.1/mod.ts";

// DB connection params
const config = {
  host: Deno.env.get("DB_HOST") || "localhost",
  port: parseInt(Deno.env.get("DB_PORT") || "5432"),
  user: Deno.env.get("DB_USER") || "postgres",
  database: Deno.env.get("DB_NAME") || "todo",
  password: Deno.env.get("DB_PASSWORD") || "",
};

// Max DB connections
const maxConnections = 10;

// Lazily create DB connections
const lazy = true;

export const dbClient = await new Pool(config, maxConnections, lazy);

Note that I don't run into this issue when I'm connecting to localhost:5432. It's only when I attempt to connect to a remote host.

I've tried two different remote hosts and they both yield the same error.

hayd commented 4 years ago

Could you try with v0.4.2 ? I wonder if this is fixed by the query lock #129.

Note: The await shouldn't be required in the Pool constructor, I think that's always sync.

haf commented 4 years ago

Repro: your quickstart https://deno-postgres.com/#/ with pg 12 over the network

saydus commented 3 years ago

Running to the same issue

Soremwar commented 3 years ago

@saydus New mantainer here!

Closed in #208