Error since v4.26.0: (connection || this.sequelize).query(...).then is not a function

See original GitHub issue

Hey happy new year! πŸŽ‰ πŸ˜ƒ

I’m having this error with sequelize v4.26.0 and above but my code worked fine with the version just below (v4.25.2). What has changed that I missed? Thank you!

P.S: Using Postgres 9.6

Unhandled rejection TypeError: (connection || this.sequelize).query(...).then is not a function
    at ConnectionManager._refreshDynamicOIDs (/Users/xdamman/github/opencollective/api/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:190:7)
    at Promise.tap.tap.connection (/Users/xdamman/github/opencollective/api/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:161:21)
From previous event:
    at ConnectionManager.connect (/Users/xdamman/github/opencollective/api/node_modules/sequelize/lib/dialects/postgres/connection-manager.js:154:8)
    at sequelize.runHooks.then (/Users/xdamman/github/opencollective/api/node_modules/sequelize/lib/dialects/abstract/connection-manager.js:327:50)
    at runCallback (timers.js:781:20)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
sushantdhimancommented, Jan 11, 2018

So it seems pg@4 doesn’t support connection.query as promise, Can you try with pg@6 and see if that resolves this issue

0reactions
raphodncommented, Jan 11, 2018

My bad, I had a look at my package-lock.json and did a npm list pg instead, it returns 4.5.6. sorry about that

Also, reading from https://github.com/sequelize/sequelize/issues/8765 it seems the issue is not from .query() but from the initial connection

Read more comments on GitHub >

github_iconTop Results From Across the Web

sequelize.query() is not a FUNCTION - node.js - Stack Overflow
I am trying to use row query, but I'm getting an error. Code: const sequelize = require('sequelize'); sequelize.query("SELECT *Β ...
Read more >
Model Querying - Basics - Sequelize
Transactions are important to ensure data integrity and to provide other benefits. This guide will show how to make the standard CRUD queries....
Read more >
How To Use Sequelize with Node.js and MySQL - DigitalOcean
Then, you will install Sequelize, configure the MySQL database, ... If not, it will return an error via the catch method and print...
Read more >
Node.js Rest APIs example with Express, Sequelize & MySQL
Next, we add configuration for MySQL database, create Tutorial model with Sequelize, write the controller. Then we define routes forΒ ...
Read more >
error: connectionmanager.getconnection was called after the ...
To avoid this issue you should NOT close the connection with sequelize, but instead set an extra option with mocha --exit which terminates...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found