SequelizeConnectionError: self signed certificate

前端 未结 1 1359
你的背包
你的背包 2021-01-04 09:03

I am trying to connect to a PostgreSQL Database that I\'ve set up in Heroku.

const { Sequelize, DataTypes, Model } =          


        
1条回答
  •  鱼传尺愫
    2021-01-04 09:12

    This is due to an (accidental) breaking change in node-postgres version 8 (see this GitHub issue).

    The solution is to pass rejectUnauthorized: false to the sequelize connection parameters, as described here by GitHub user jsanta:

    const sequelize = new Sequelize({
      database: "[wont'd show db]",
      username: "[won't show username]",
      password: "[won't show password]",
      host: "ec2-54-221-195-148.compute-1.amazonaws.com",
      port: 5432,
      dialect: "postgres",
      dialectOptions: {
        ssl: {
          require: true,
          rejectUnauthorized: false // <<<<<<< YOU NEED THIS
        }
      },
    });
    

    0 讨论(0)
提交回复
热议问题