我不断收到此错误:Error: self signed certificate
在终端中运行此命令时:
knex migrate:latest --env production
我的 knexfile.js
require('dotenv').config();
module.exports = {
development: {
client: "pg",
connection: {
host: "localhost",
database: "my-movies"
}
},
production: {
client: "pg",
connection: process.env.DATABASE_URL
}
};
我的 .env 文件:
DATABASE_URL=<my_database_url>?ssl=true
Heroku 应用信息:
Addons: heroku-postgresql:hobby-dev
Auto Cert Mgmt: false
Dynos:
Git URL: https://git.heroku.com/path-name.git
Owner: xxxxxxxxx@xxxx.com
Region: us
Repo Size: 0 B
Slug Size: 0 B
Stack: heroku-18
Web URL: https://my-appname.herokuapp.com/
我已经尝试在 ssl: true 的 knexfile 中的生产中放置一个键值对,但我得到了同样的错误。过去我已经这样做了很多很多次,从来没有遇到过这个问题。想知道 Heroku 是否改变了任何东西,但是在搜索他们的文档时我找不到任何东西。
最佳答案
以下配置位于 knexfile.js
为我工作。
...
production: {
client: 'postgresql',
connection: {
connectionString: process.env.DATABASE_URL,
ssl: { rejectUnauthorized: false }
}
}
...
DATABASE_URL
是你通过运行 heroku config --yourAppName
得到的
关于javascript - Knex Heroku 错误 : self signed certificate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61785729/