throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string'

Viewed 5563

I try to connect my database to express, but I've this message.. on PostgreSQL

 throw new Error('SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string'

if somebody had fix the same problem ;)

3 Answers

I had this same error message come up when I tried to connect my website running locally to my database running locally.

I was able to connect my local website to my live database. And my live website worked properly with my live database too.

But I couldn't connect my local website (or Postman) to my local database.

However, I just received help from a friend to fix this. I added this line to the top of my pool.js file:

import dotenv from 'dotenv/config';

The problem was that it wasn't accessing the environment variables from the pool.js file. Although, my friend said a better solution would be to add the 'dotenv/config' to a script in the package.json file, but he wasn't sure what the proper syntax was for that, so I'm going to try to find that out next.

when you installed Postgresql did you set the password for Postgres user? Because I had this same issue and I solved it by doing this silly but apparently important step when you installed Postgres. run the shell and then use the command \password.

Then should put this same password in the code you use to connect the database with express.

The syntax is

nodemon -r dotenv/config src/server.js
Related