Error: connect ECONNREFUSED when connecting to a custom database

I’m trying to connect my Postgres database into my application but getting the following error.
I have made my database using Heroku and it looks like this (I have changed a few characters here for privacy)

my script files look like this

and this is my error on save and try

can someone please help me?

1 Like

@voletirajkumar have you managed to get your issue resolved?

strange I get the same kind of error but connecting to MongoDB: “[MongoNetworkError] failed to connect to server [localhost:27017] on first connect [Error: connect ECONNREFUSED\n at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16)\n at TCPConnectWrap.callbackTrampoline (internal/async_hooks.js:126:14) {\n name: ‘MongoNetworkError’,\n errorLabels: [Array],\n [Symbol(mongoErrorContextSymbol)]: {}\n}]”

Please note that my database is in the cloud not localhost