Home Sequelize and peer authentication for Postgres?
Reply: 1

Sequelize and peer authentication for Postgres?

Andre M
Andre M Published in 2017-09-13 21:33:00Z

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://", {});

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?

Andre M
Andre M Reply to 2017-09-13 22:16:29Z

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 pg@6.4.1 and sequelize@4.4.2.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.300179 second(s) , Gzip On .

© 2016 Powered by cudou.com design MATCHINFO