Skip to content

Console-generated psql connection example in postgres-prisma-postgres does not work, possible solution is provided here #697

@coding-to-music

Description

@coding-to-music

I am using ubuntu 20.04, psql was installed via

sudo apt update
sudo apt install postgresql

Verify psql and OS

psql --version

Output

psql (PostgreSQL) 12.14 (Ubuntu 12.14-0ubuntu0.20.04.1)

The Suggested psql connection example in postgres-prisma-postgres does not work:

# Format:
psql "postgresql://username:password@host:port/database"

# Example provided by the console:
psql "postgres://default:************@ep-morning-dust-436279.us-east-1.postgres.vercel-storage.com:5432/verceldb"

It gives this error:

psql: error: ERROR:  Endpoint ID is not specified. Either please upgrade the postgres client library (libpq) for SNI support or pass the endpoint ID (first part of the domain name) as a parameter: '?options=project%3D<endpoint-id>'. See more at https://neon.tech/sni
ERROR:  connection is insecure (try using `sslmode=require`)

However, this connection string does work, if the endpoint is appended:

# Format:
psql "postgresql://username:password@host:port/database?options=project%3D<endpoint>"


# Example:
psql "postgres://default:************@ep-morning-dust-436279.us-east-1.postgres.vercel-storage.com:5432/verceldb?options=project%3Dep-morning-dust-436279"

Output:

psql (12.14 (Ubuntu 12.14-0ubuntu0.20.04.1), server 15.2)
WARNING: psql major version 12, server major version 15.
         Some psql features might not work.
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)
Type "help" for help.

verceldb=> \dt
        List of relations
 Schema | Name  | Type  |  Owner  
--------+-------+-------+---------
 public | users | table | default
(1 row)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions