denodrivers/postgres

PostgresError: unsupported startup parameter: options

DomThePorcupine opened this issue · 3 comments

Hi all,

I have a little project that I've been working on intermittently, it was using version v0.15.0 of the postgres driver and everything has been working great! However when I updated to v0.16.0 I now get a strange error message:

error: Uncaught (in promise) PostgresError: unsupported startup parameter: options
      throw new PostgresError(parseNoticeMessage(msg));
            ^
    at assertSuccessfulStartup (https://deno.land/x/postgres@v0.16.0/connection/connection.ts:80:13)
    at Connection.#startup (https://deno.land/x/postgres@v0.16.0/connection/connection.ts:409:7)
    at async Connection.startup (https://deno.land/x/postgres@v0.16.0/connection/connection.ts:489:11)
    at async PoolClient.connect (https://deno.land/x/postgres@v0.16.0/client.ts:220:7)
    at async DeferredAccessStack.pop (https://deno.land/x/postgres@v0.16.0/utils/deferred.ts:121:7)
    ...

Here is the code snippet I used to reproduce the issue (connecting to a supabase instance), it works fine on v0.15.0 but gives the error message on v0.16.0

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

const DB_HOST: string = Deno.env.get("DB_HOST") || "";
const DB_USER: string = Deno.env.get("DB_USER") || "";
const DB_PASSWORD: string = Deno.env.get("DB_PASSWORD") || "";
const DATABASE: string = Deno.env.get("DATABASE") || "";
const CONNECTION_STRING =
  `postgres://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:6543/${DATABASE}`;

const pool = new Pool(CONNECTION_STRING, 3, true);

const connection = await pool.connect();
const query = await connection.queryObject`SELECT * FROM users`;
connection.release();
console.log(query.rows);

Did the interface for the pool connection change in the new release?

Thanks so much for your help,
Dom

Hi @DomThePorcupine,

Recently support for the options parameter was added, but apparently Supabase doesn't support it. I just committed a patch to not pass this option when you haven't supplied any options so with your current setup you'll be just fine

Try the fix with https://raw.githubusercontent.com/Soremwar/deno-postgres/687130ef5e39fc4ba4e2bbf990bdb0a89927b495/mod.ts and confirm that it is working, then I'll release a patch version right away

Confirmed working!

Thanks so much - sorry for my late reply 😅

0.16.1 released with the fix, thanks for the report @DomThePorcupine