I am attempting to connect to my database(s) via replication. I have filled out the fields in the replication option in a variety of ways only to get the same error each time:
password authentication failed for user "my_local_system_username"
where somehow sequelize/pg thinks that I am trying to log in with my operating system user name???
Here is what I tried:
const serverParams = {
user: auth.db.user,
password: auth.db.password,
port: 5432
};
const dbConfig = {
options: {
dialect: 'postgres',
protocol: 'tcp',
replication: {
write: {},
read: process.env.NODE_ENV === 'production' ?
[
{
...serverParams,
host: 'db1.lupoex.com'
},
{
...serverParams,
host: 'db2.lupoex.com'
}
] :
[
{
...serverParams,
host: 'test.db.lupoex.com'
}
]
},
pool: {
max: 5,
min: 0,
idle: 5000,
acquire: 20000
}
//logging: function(query) {
// console.log(query)
//}
}
};
new Sequelize('database', null, null, dbConfig.options);
Thanks in advance, all comments/suggestions welcome.
Adding require('dotenv').config(); to the top of my config file fixed it for me.
More convo on the issue here: https://github.com/sequelize/cli/issues/641
I figured this out. It seems the config needs a username like so:
const serverParams = {
user: auth.db.user,
username: auth.db.user,
password: auth.db.password,
port: 5432
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With