1
votes

My postgres database has been set up to use peer authentication and I am not sure how to tell Sequelize to use this method?

Currently we are using the following:

new Sequelize("postgres://127.0.0.1/dbname", {});

I also tried the following which did not work

new Sequelize("postgresql:///dbname?host=/var/lib/postgresql");

In both cases I get the error:

SequelizeBaseError: password authentication failed for user"

Can anyone help?

1

1 Answers

2
votes

A bit more exploration shows the following will do the job:

new Sequelize('mydb', undefined, undefined, {
     host: '/var/run/postgresql',
     dialect: 'postgres'
   });

The actual connection is handled by the package 'pg' and this was documented in an issue.

Note, I have tested this to work with [email protected] and [email protected].