Issues Accessing Retool database from outside

Hello, I am not able to connect to my database: I am copying the string from the UI

PGPASSWORD=REDACTED psql -h REDACTED.us-west-2.retooldb.com -U retool retool
 
But then I get this error:
psql: error: connection to server at "REDACTED.us-west-2.retooldb.com" (IP_REDACTED), port 5432 failed: server closed the connection unexpectedly
                This probably means the server terminated abnormally
                before or while processing the request.
SSL SYSCALL error: Connection reset by peer
connection to server at "REDACTED.us-west-2.retooldb.com" (IP_REDACTED), port 5432 failed: ERROR:  connection is insecure (try using `sslmode=require`)
REDACTED... port 5432 failed: server closed the connection unexpectedly
                This probably means the server terminated abnormally
                before or while processing the request.
SSL SYSCALL error: Connection reset by peer
connection to server at "REDACTED.us-west-2.retooldb.com" (IP_REDACTED), port 5432 failed: ERROR:  connection is insecure (try using `sslmode=require`)

I am also trying from sqlalchemy where sslmode is set in the URL itself:

connection_string="postgresql+psycopg2://retool:REDACTED@REDACTED.us-west-2.retooldb.com/retool?sslmode=require"
engine = create_engine(connection_string)
df = pd.read_sql_query('SELECT * FROM reagent_table;', engine)

Which is also throwing an error:

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) connection to server at "REDACTED.us-west-2.retooldb.com" (IP_REDACTED), port 5432 failed: server closed the connection unexpectedly
        This probably means the server terminated abnormally
        before or while processing the request.
SSL SYSCALL error: Connection reset by peer

Any thoughts on what might be wrong? It seems like something is up on the back end since I am copying these connection strings directly from the UI and trying both sqlalchemy and psql. But could be something I am missing.

2 Likes

hmmm... other than whitelisting Retool servers (which I don't think really applies here) and VPN issues, have you tried sslmode=verify-ca/verify-full?

Thanks for idea! Those modes do not work. However, since last testing, it appears perhaps something changed and it is working! I previously tried on two different networks to ensure it wasn't a firewall issue on office network.

Both examples are working for me now.

1 Like