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'
},
{
...serverParams,
host: 'db2.lupoex'
}
] :
[
{
...serverParams,
host: 'test.db.lupoex'
}
]
},
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 ments/suggestions wele.
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.'
},
{
...serverParams,
host: 'db2.lupoex.'
}
] :
[
{
...serverParams,
host: 'test.db.lupoex.'
}
]
},
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 ments/suggestions wele.
Share Improve this question edited Nov 17, 2017 at 19:53 istrau2 asked Nov 16, 2017 at 17:20 istrau2istrau2 3677 silver badges16 bronze badges2 Answers
Reset to default 3Adding require('dotenv').config();
to the top of my config file fixed it for me.
More convo on the issue here: https://github./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
};