gpt4 book ai didi

node.js - SequelizeConnectionError : The server does not support SSL connections

转载 作者:行者123 更新时间:2023-12-03 21:15:25 25 4
gpt4 key购买 nike

我正在尝试将我的项目与 PostgreSQL 连接,但显示此错误。请帮我
我已经安装了 Postgres.app 和 GUI PgAdmin。

Unhandled rejection SequelizeConnectionError: The server does not support SSL connections
at /Users/inamur/Documents/Project/project-api/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:186:20
at Connection.connectingErrorHandler (/Users/inamur/Documents/Project/project-api/node_modules/pg/lib/client.js:203:14)
at Connection.emit (events.js:223:5)
at Connection.EventEmitter.emit (domain.js:475:20)
at Socket.<anonymous> (/Users/inamur/Documents/Project/project-api/node_modules/pg/lib/connection.js:90:21)
at Object.onceWrapper (events.js:313:26)
at Socket.emit (events.js:223:5)
at Socket.EventEmitter.emit (domain.js:475:20)
at addChunk (_stream_readable.js:309:12)
at readableAddChunk (_stream_readable.js:290:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead (internal/stream_base_commons.js:181:23)

这是我的 .env 文件
JWT_SECRET='UserNews'
DB_LINK='postgres://root:root@localhost:5432/SCROLL001?ssl=true'

这是连接文件。
const sequelize = new Sequelize(process.env.DB_LINK, {
dialect: 'postgres',
protocol: 'postgres',
dialectOptions: {
ssl: {
require: 'true'
}
}
});

最佳答案

我已经解决了这个问题。

const sequelize = new Sequelize(process.env.DB_LINK, {
dialect: 'postgres',
protocol: 'postgres',
dialectOptions: {}, //removed ssl
});
更改数据库链接
DB_LINK='postgres://root:root@localhost:5432/SCROLL001'

关于node.js - SequelizeConnectionError : The server does not support SSL connections,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61153275/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com