Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string #908 #909

Open
zeronaldoojr opened this issue Aug 24, 2022 · 2 comments

Comments

@zeronaldoojr
Copy link

How adjust this error?
my package.json is he
"scripts": {
"dev": "docker-compose up -d && nodemon",
"unit-test": "jest --runInBand --coverage --verbose -c jest.unit.config.js",
"migrate": "node-pg-migrate"
},
my .env is he
ENV=dev
EXPRESS_PORT = 3333
SECRET=SECRET
API_URL=http://localhost:3333/
POSTGRES_DATABASE=Carrarapets_dbo
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_HOST=localhost
POSTGRES_PORT=5432

@karvaton
Copy link

The easiest way to solve this problem is to specify your database url by setting the environment variable DATABASE_URL:
DATABASE_URL=postgres://username:password@hostname:5432/db_name

Seconfd way is to install config:
npm i config
Then you should create folder 'config' in the root directory, in this folder create file default.json wjth your database connection information:

{
  "db": {
    "url": "postgres://postgres:password@localhost:5432/database"
  }
}

or

{
  "db": {
    "user": "postgres",
    "password": "password",
    "host": "localhost",
    "port": 5432,
    "database": "database"
  }
}

In package.json you should pass path to this config file as an argument:

"migrate": "node-pg-migrate -f \"config/default.json\""

@manuganji
Copy link

You need to install dotenv. They didn't mention dotenv as a peer dependency in their package.json so it's not loading the environment variables before running commands.

"peerDependencies": {
"pg": ">=4.3.0 <9.0.0"
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants