2

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 Answer 1

2

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].

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.