heroku Postgres - sequelize : no pg_hba.conf entry for host heroku Postgres - sequelize : no pg_hba.conf entry for host heroku heroku

heroku Postgres - sequelize : no pg_hba.conf entry for host


Change your dialectOptions to:

dialectOptions: {    ssl: {        rejectUnauthorized: false    }}


As explained in this related answer, setting rejectUnauthorized: false is a bad idea because it allows you to create non-encrypted connections to your database and can, thus, expose you to MITM attack (man-in-the-middle attacks).

A better solution is to give your Postgres client the CA that you want it to use. In my case it was a CA used by AWS RDS for the North Virginia region (us-east-1). I downloaded the CA from this AWS page, placed it in the same directory as the file I wanted to use connect to the DB and then modified my config to:

{  ...  dialectOptions: {    ssl: {      require: true,      ca: fs.readFileSync(`${__dirname}/us-east-1-bundle.pem`),    },  },}