Postgres connection terminating unexpectedly

Connection to Postgres DB is continuously being terminated even on the first deploy. It just doesn’t let Node App execute any query. Here is the Error Log from my app (flyctl logs -a d-aps-nes)

2022-11-16T15:58:54Z app[91d96c97] sin [info]16/Nov/2022:15:58:54.582 +00:00 Error: Connection terminated unexpectedly
2022-11-16T15:58:54Z app[91d96c97] sin [info]    at Connection.<anonymous> (/opt/envoy/nes/node_modules/pg-promise/node_modules/pg/lib/client.js:132:73)
2022-11-16T15:58:54Z app[91d96c97] sin [info]    at Object.onceWrapper (events.js:519:28)
2022-11-16T15:58:54Z app[91d96c97] sin [info]    at Connection.emit (events.js:400:28)
2022-11-16T15:58:54Z app[91d96c97] sin [info]    at Socket.<anonymous> (/opt/envoy/nes/node_modules/pg-promise/node_modules/pg/lib/connection.js:108:12)
2022-11-16T15:58:54Z app[91d96c97] sin [info]    at Socket.emit (events.js:412:35)
2022-11-16T15:58:54Z app[91d96c97] sin [info]    at endReadableNT (internal/streams/readable.js:1333:12)
2022-11-16T15:58:54Z app[91d96c97] sin [info]    at processTicksAndRejections (internal/process/task_queues.js:82:21)
2022-11-16T15:58:54Z app[91d96c97] sin [info]

This error is same on literally any query I try to execute. It was working fine about 2 hours ago and suddenly starting giving this error.

I even tried destroying the app and redeployed but no luck.

Destroying the Postgres DB instance and recreating it solved the issue. The issue probably occurred because I updated flyctl but my DB instance was old.