【发布时间】:2019-11-08 05:37:59
【问题描述】:
我正在尝试连接到我的 postgresql DB 我正在使用pg 库,我的代码如下所示
const dbcreds = require("./dbconfig.json")
const { Pool } = require('pg')
pushToDB = async function (shiftData) {
const pool = await new Pool({
host: dbcreds.dbhost,
user: dbcreds.user,
password: dbcreds.dbpassword,
database: dbcreds.dbname,
})
await pool.connect()
await pool.query('INSERT into working (shift_id, client_id, organisational_unit, discipline, site, starts_at, ends_at, status) VALUES($1, $2, $3) returning id', ['shift id', 'client id', 'third'], function (err, result) {
done();
if (err) {
return console.error('error running query', err);
}
res.send(result);
});
}
在运行我的代码后检查 AWS 上的日志显示了这一点,我认为这可能是由于 AWS 权限错误,但我不确定我需要更改什么:
2019-06-26 09:09:46 UTC:46-247-17-105.fluidata.co.uk(50780):robert@sstreamdb:[9627]:FATAL: password authentication failed for user "robert"
2019-06-26 09:09:46 UTC:46-247-17-105.fluidata.co.uk(50780):robert@sstreamdb:[9627]:DETAIL: Role "robert" does not exist.
Connection matched pg_hba.conf line 13: "host all all 0.0.0.0/0 md5"
----------------------- END OF LOG ----------------------
【问题讨论】:
标签: node.js postgresql amazon-web-services amazon-rds