NeonN
Neon13mo ago
17 replies
slow-yellow

Lua/pgmoon connection issues with Neon PostgreSQL endpoint ID configuration

Description:
I'm trying to connect to a Neon PostgreSQL database from a Lua application using pgmoon. Im:
* Attempting to establish a connection to Neon PostgreSQL from Lua using pgmoon library
* Running on Replit with PostgreSQL 15

The reason why is because I need to store user data and achievements in a PostgreSQL database

Here's my current connection code:
local pg = pgmoon.new({
    host = os.getenv("PGHOST"),
    port = 5432,
    user = os.getenv("PGUSER"),
    password = os.getenv("PGPASSWORD"),
    database = os.getenv("PGDATABASE"),
    ssl = true,
    sslmode = "require"
})

Error message:
database connection failed: 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=endpoint%3D<endpoint-id>'. See more at https://neon.tech/sni

What I've tried:
* Adding endpoint_id parameter
* Adding options parameter with encoded endpoint
* Using database_url with endpoint options
* Setting sslmode to require
* Specifying the endpoint ID in the password field

Extra information:
* My phone is constantly on do not disturb, so if you have an answer, ping me
* My timezone is Cst and I am available until 10 p.m.
Was this page helpful?