4

Linux Pop! distribution (v 17 Ubuntu) Custom-built desktop machine

I've been working for a long time to try to get just a simple sequelize db:migrate command to work.

I have postgresql installed and if I do su - postgres and then psql I can get into the psql commannd prompt (and can also get out, using \q).

I'm working on a project where we need to use the sequelize-cli manager. I've installed npm i --save [email protected] [email protected] [email protected].

Then I did sequelize init in my directory, and adjusted the database files.

const path = require("path");

module.exports = {
  "config": path.resolve("./db/config", "config.json"),
  "models-path": path.resolve("./db/models"),
  "seeders-path": path.resolve("./db/seeds"),
  "migrations-path": path.resolve("./db/migrations")
};

And here's my config.json file for sequelize:

{
  "development": {
    "username": "postgres",
    "password": null,
    "database": "address-bloc-dev",
    "host": "127.0.0.1",
    "dialect": "postgres",
    "logging": false
  },
  "test": {
    "username": "postgres",
    "password": null,
    "database": "address-bloc-test",
    "host": "127.0.0.1",
    "dialect": "postgres",
    "logging": false
  }
}

No matter what I do, whenever I try to do sequelize db:migrate, I get this:

$ sequelize db:migrate

Sequelize CLI [Node: 6.11.4, CLI: 4.0.0, ORM: 4.32.6]

Loaded configuration file "db/config/config.json".
Using environment "development".
sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:237:13

ERROR: password authentication failed for user "postgres"

I get this error whether I'm logged in as my main, normal user, or when I'm logged in as postgres. I can su between the two, navigate to the correct directory, and still get the same result.

I was earlier also getting another error, postgres is not in the sudoers file. This incident will be reported..

Per a recommendation on stackoverflow, I tried adding the postgres user to sudo usermod -a -G sudo postgres and made postgres an official account. It shows up on my login screen.

This did manage to make that second sudoers... error go away.

However, I still ultimately get the same password authentication failure... error.

I've also tried installing npm both as a regular user, and with the sudo command.

And I've tried going into the pg_hba.config file and changing peer to ident, per another recommendation on stackoverflow. No luck, still.

Any ideas about why I can't get sequelize-cli to perform this operation?

EDIT: I've received some kind responses, but so far I haven't been able to figure out what I'm doing wrong. Made some notes in a comment. Thank you.

14
  • If you've reconfigured it to use ident I guess you'll have to actually set up a password too and pass that? I'm fairly sure it doesn't use password authentication when you are the postgres user. Commented Apr 23, 2018 at 23:26
  • That is actually a security protection in postgresql configurations. You can't login in a third party client without a password, unless you configure it to do so. (pg_hba.conf file). So, setup a password and try adding it on your configuration. Commented Apr 23, 2018 at 23:28
  • 2
    In your configuration it is null "password": null, for both environments. Also when responding to comments always tag the people you are talking to using the @ followed by the person name. That way we receive the notification. Commented Apr 24, 2018 at 1:06
  • 1
    @user123456 take A look here serverfault.com/q/110154/234220 . It may be using the default password configured to access without it in local connections (same machine) Commented Jul 15, 2018 at 20:56
  • 1
    Yes. I would recommend creating a different user for your application though. See it here: stackoverflow.com/q/14734912/460557 @user123456 Commented Jul 15, 2018 at 22:35

0

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.