azure + postgresql: How to fix error: Unable to connect to server: server closed the connection unexpectedly

Viewed 2419

i use postgresql server in azure. Until few hours ago I was able to access the server from pgAdmin 4 but now I get the following error:

' Unable to connect to server: server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. '

Same for using psql.

From my node js backend app I can access the database to get and edit the db.

How can I fix the access for the db server from pgAdmin 4 and psql?

EDIT: I managed to connect from psql but still not from pgAdmin 4, and after enabling disconnection logs in azure I get this log: ' An existing connection was forcibly closed by the remote host '.

3 Answers

You need to add your IP address or VNet in Connection Security. By default it is blocked.

In my case, I had chosen to create an Azure SQL Database rather than an Azure Database for PostgreSQL. I doubt many others have made this mistake, but if you have, it will cause this error!

Related