我按照以下步骤操作:https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction
当我运行heroku本地它无法连接 - 我看到它正在使用process.env.DATABASE_URL并使用以下内容将其输入到我的本地.env文件:https://devcenter.heroku.com/articles/heroku-local
但它仍然无法连接,我添加了一个console.log来查看错误:
“错误:主机”62.90.xxx.yyy“没有pg_hba.conf条目,用户”用户名“,数据库”密码“,SSL关闭”
现在怎么办?
1 回答
经过大量搜索后发现,添加'pg.defaults.ssl = true'可以解决我的问题,同时让我尽可能接近Heroku提供的样本 .
这是我的代码