Forums

I'm having trouble connecting to my Neon postgreSQL database from my webapp

I get this error in the console when trying to write to the neon db but it worked fine in test prior to the deployment: Error writing to database: 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

I'm using psycopg2 with a connection url via the .env file. Am I missing something that I need to setup within pythonanywhere?

Are you using a different version of psycopg2 locally?

no I'm using 2.9.10 which is also installed on pythonanywhere. very confused on what to do here

the error I'm getting now is actually this: 2025-02-26 14:45:20 Error writing to database: could not connect to server: No such file or directory#012#011Is the server running locally and accepting#012#011connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

which sounds like it's looking for a local connection but I'm not sure how to change this. there's nothing in my code that is relating to a local instance so do I need to update a config file somewhere?