错误:knex:未知的配置选项“客户端”价值
我正在尝试将heroku 上的postgres 数据库连接到我在heroku 上托管的服务器。成功运行 git push heroku main 后,我运行heroku logs --tail 来获取日志,并收到此错误
我不知道这意味着什么,因此,数据库似乎没有连接到我的服务器,并且每当我尝试使用时都会收到 404 错误我的应用程序去取。 我的 server.js 代码片段
const knex = require('knex');
const db = knex({
client: 'pg',
connection: {
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false,
},
},
});
package.json
{
"name": "facedetection_api",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"start": "node server.js",
"start:dev": "nodemon server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"nodemon": "^2.0.15"
},
"dependencies": {
"bcryptjs": "^2.4.3",
"clarifai": "^2.9.1",
"cors": "^2.8.5",
"express": "^4.17.3",
"knex": "^1.0.4",
"pg": "^8.7.3"
}
}
I am trying to connect a postgres database on heroku to a server I hosted on heroku. Ater running git push heroku main
successfully, I then ran heroku logs --tail
to get the logs, and I got this error
I don't know what this means, and consequently, the database doesn't seem to be connected to my server and I get a 404 error anytime I try to use my app to fetch.
My server.js code snippet
const knex = require('knex');
const db = knex({
client: 'pg',
connection: {
connectionString: process.env.DATABASE_URL,
ssl: {
rejectUnauthorized: false,
},
},
});
package.json
{
"name": "facedetection_api",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"start": "node server.js",
"start:dev": "nodemon server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"nodemon": "^2.0.15"
},
"dependencies": {
"bcryptjs": "^2.4.3",
"clarifai": "^2.9.1",
"cors": "^2.8.5",
"express": "^4.17.3",
"knex": "^1.0.4",
"pg": "^8.7.3"
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论