【发布时间】:2021-10-16 01:21:43
【问题描述】:
我在将 sequelize 连接到 Amazon RDS Postgres DB 时遇到问题。
下面是我的连接字符串:
const dbConfig = new Sequelize(database, username, password, {
host: host,
ssl: true,
dialect: "postgres",
logging: console.log,
});
这会打印出 ff 错误:
SequelizeConnectionError: password authentication failed for user "USER01"
这个 USER01 是我的本地 postgres 用户名。我什至不知道它为什么要连接到我的本地服务器。
如果我提供 ff 连接字符串:
const dbConfig = new sequelize.Sequelize(database, username, password, {
host: host,
ssl: true,
dialect: "postgres",
dialectOptions: {
ssl: "Amazon RDS"
},
logging: console.log,
});
我得到 ff 错误:
C:\Users\USER01\Desktop\myproject\node_modules\pg\lib\connection.js:85
if ('key' in self.ssl) {
^
TypeError: Cannot use 'in' operator to search for 'key' in Amazon RDS
at Socket.<anonymous> (C:\Users\USER01\Desktop\myproject\node_modules\pg\lib\connection.js:85:19)
at Object.onceWrapper (events.js:422:26)
at Socket.emit (events.js:315:20)
at addChunk (_stream_readable.js:295:12)
at readableAddChunk (_stream_readable.js:271:9)
at Socket.Readable.push (_stream_readable.js:212:10)
at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
注意:我要证明的连接字符串是我的 Amazon RDS 连接详细信息。
【问题讨论】:
标签: node.js amazon-web-services sequelize.js amazon-rds