错误:knex:未知的配置选项“客户端”价值

发布于 2025-01-15 18:56:51 字数 1145 浏览 3 评论 0原文

我正在尝试将heroku 上的postgres 数据库连接到我在heroku 上托管的服务器。成功运行 git push heroku main 后,我运行heroku logs --tail 来获取日志,并收到此错误  错误: knex: 未知的配置选项“客户端”值

我不知道这意味着什么,因此,数据库似乎没有连接到我的服务器,并且每当我尝试使用时都会收到 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
 Error: knex: Unknown configuration option 'client' value

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文