Answer a question

I am trying to run migrations on my Nodejs application hosted on Heroku using the Heroku free Postgres database.

I am using Sequelize as my ORM.This is my configuration for the production connection.

const dotenv = require('dotenv');

dotenv.config();

module.exports = {
  production: {
    use_env_variable: 'DATABASE_URL',
    dialect: process.env.DIALECT,
    protocol: process.env.DIALECT,
  }
}

When I use the above configuration, I get the following error: no pg_hba.conf entry for host "000.000.000.0", user "yyyyyyyyyyyyyy", database "xxxxxxxxxxxxx", SSL off

However when I add the options below to the config, I get a self-signed certificate error.

dialectOptions: {
ssl: true
}

Please, how do I resolve this?

Answers

Change your dialectOptions to:

dialectOptions: {
    ssl: {
        rejectUnauthorized: false
    }
}
Logo

PostgreSQL社区为您提供最前沿的新闻资讯和知识内容

更多推荐