Thursday, 4 May 2017

PostgreSQL keep failing password auth in Node.js

Seems like There's something wrong with connect function.

config.DATABASE_URL is initialized using environment export DATABASE_URL=postgres://bustabit:1234@localhost/bustabitdb

function connect(callback) {
    return pg.connect(config.DATABASE_URL, callback);
}


error: password authentication failed for user "bustabit"
    at Connection.parseE (/home/bobbysun/busta/bustabit-gameserver/node_modules/pg/lib/connection.js:526:11)

It's kind of weird that It fails just like in connect function when I try to login psql in shell like:

psql -d bustabitdb -U bustabit
psql: FATAL:  Peer authentication failed for user "bustabit"

but This one works:

psql bustabit -h 127.0.0.1 -d bustabitdb
Password for user bustabit:
psql (9.3.16)bustabitdb=>

Does anybody have any idea why this happens? I think I should change DATABASE_URL but I'm pretty new to postgreSQL so I have no idea what to change.



via boombamboo

No comments:

Post a Comment