sequelize: Unhandled rejection TypeError: connection.query(...).on is not a function

What you are doing?

Trying to connect to postgres running localy

Unhandled rejection TypeError: connection.query(...).on is not a function

What do you expect to happen?

I wanted to conenct and initialize the DB - it worked using MSSQL

What is actually happening?

Unhandled rejection TypeError: connection.query(…).on is not a function

Dialect: postgres

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Oh I see. I just installed version pg@6.4.1 and it worked fine. It may be an issue related with the support for pg ^ 7.0.0. That’s good that you have found a workaround

try updating the sequelize dependency in your project’s package.json to the latest version, that seemed to solve it for me:

    "sequelize": "^4.22.12",
    "sequelize-cli": "^3.1.0",

Can Some One Please look into this ASAP

conn_issue

Tried with all the possibilities mentioned as per the comments ,

PostGreSql Version : postgresql-10.0-1-windows-x64 Sequelize-auto version : “version”: “0.4.28” pg : “version”: “7.3.0” pg-host : “version”: “2.3.2”

Can some one please let me know the correct appropriate fix . Got Stuck since 2 days…

Thanks, Sathish Barapata

I am also getting “connection.query(…).on is not a function” when trying to use sequelize-auto, downgrading pg from 7.4.0 to 6.4.1 didn’t help. Is there a way that sequelize-auto is working right now?

Just a bit of help for the Sequelize maintainers: node-postgres is now returning promises, so .on() is no longer a valid method in sequelize/lib/dialects/postgres/connection-manager.js:158:12 and in a few other places in that dialect.

@alexpmorris 's comment worked for me! I just updated sequelize from ^3 to ^4.22.12