首页 > 解决方案 > 我无法在 Heroku 上使用 Strapi 连接到 Postgres DB

问题描述

如此处所述,尝试使用 Postgres 在 Heroku 上部署 Strapi

https://strapi.io/documentation/v3.x/deployment/heroku.html

但我得到这个错误

error: no pg_hba.conf entry for host "84.212.51.43", user "ssqqeaz***", database "d6gtu***", SSL off

我使用 Heroku Postgres 插件。

我的数据库配置:

module.exports = ({ env }) => ({
  defaultConnection: 'default',
  connections: {
    default: {
      connector: 'bookshelf',
      settings: {
        client: 'postgres',
        host: env('DATABASE_HOST', '127.0.0.1'),
        port: env.int('DATABASE_PORT', 27017),
        database: env('DATABASE_NAME', 'strapi'),
        username: env('DATABASE_USERNAME', ''),
        password: env('DATABASE_PASSWORD', ''),
      },
      options: {
        ssl: true
      },
    },
  },
});

为什么?请帮忙!

标签: postgresqlheroku-postgresstrapi

解决方案


试着ssl : true变成ssl : false


推荐阅读