sequelize-typescript: Cannot read property 'getQueryInterface' of undefined
ts-node version 8.3.0 typescript version 3.8.3 node nersion 14.4.0 sequelize version 6.2.4 sequelize-typescript version 1.1.0
TypeError: Cannot read property 'getQueryInterface' of undefined
at Function.get queryInterface [as queryInterface] (/Users/caiminhao/Documents/work/MOCAPE/backend/node_modules/sequelize/lib/model.js:55:27)
at isFunctionMember (/Users/caiminhao/Documents/work/MOCAPE/backend/node_modules/sequelize-typescript/dist/model/model/model.js:99:25)
at /Users/caiminhao/Documents/work/MOCAPE/backend/node_modules/sequelize-typescript/dist/model/model/model.js:96:5
at Array.filter (<anonymous>)
at Object.<anonymous> (/Users/caiminhao/Documents/work/MOCAPE/backend/node_modules/sequelize-typescript/dist/model/model/model.js:95:6)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Module._compile (/Users/caiminhao/Documents/work/MOCAPE/backend/node_modules/source-map-support/source-map-support.js:521:25)
at Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Object.nodeDevHook [as .js] (/Users/caiminhao/Documents/work/MOCAPE/backend/node_modules/ts-node-dev/lib/hook.js:61:7)
at Module.load (internal/modules/cjs/loader.js:1049:32)
[ERROR] 17:57:04 TypeError: Cannot read property 'getQueryInterface' of undefined
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 54
- Comments: 27
Commits related to this issue
- Add an extra endpoint to query to our provisioned server to get all the images that has been filtered by users From the previous commit, the endpoint added was to download an image from a public url... — committed to okpalaChidiebere/image-filter-code by okpalaChidiebere 4 years ago
- CHKN-187downgrading sequelize to 5.22.3 - https://github.com/RobinBuschmann/sequelize-typescript/issues/805 — committed to chaeinP/42checkin_server by ohjongin 3 years ago
Guys please do not reply “same”, it does not add anything to the discution. Use the thumb up reaction on the top message if you want to show your interest in the resolution of this issue.
I have this error when using reference in one model and this model starts later (using ModelName.init) After change order of .init, solved my problem.
I solved it by downgrading sequelize to 5.21.10
same
I m getting this error too, is there any to solve this bug without downgrading the version ?
Also solved by downgrading sequelize (this time to
5.22.3
)EDIT: Already fixed in master.
While examining the stack trace, the issue is caused because when the
sequelize-typescript#Model
import is loaded, it scans all property names on theSequelize#Model
class to check if they are functions.However, some are getters which require
this.sequelize
to be set which requires the Model to be instantiated withthis.constructor.sequelize
set to thesequelize
instance.@RobinBuschmann I think an easy fix is to add
queryInterface
andqueryGenerator
to theFORBIDDEN_KEYS
list, asQueryInterface
is already in there.I was able to resolve that by upgrading also packages
sequelize-cli
andsequelize-typescript
. so currently I have:@vjpr it also works by installing
next
npm install sequelize-typescript@next