SOLVED : NODE-RED crash while restarting Postgres service in WINDOWS!

Case: The node "node-red-contrib-postgresql" when deployed in flow works smooth. But when the postgres service is stopped for any reasons. The node causes the whole nodered to crash, resulting in this error :

error: terminating connection due to administrator command\n at Parser.parseErrorMessage

Error Scenario: This error occurs when the connection pool inside the postgres node isn't written to handle error.

Fix: Open postgresql.js from the node-red-contrib-postgresql folder from node_modules and copy paste the below code to handle the connection pool error.

this.pgPool.on('error', (err, client) => {
			console.log('postgres connection error : ' + err)

For additional details about this problem visit this link and this.

Have you raised an issue (or better a pull request) on that nodes repository ? Would be great to get it fixed for all..

I will do that.

1 Like