I got this error when codes hitting require('./models').sequelize.sync()
. (models
is a directory created by running command sequelize init
) Could anyone give me some hints about what induces this error?
> node src/server.js
Unhandled rejection TypeError: Dependency name must be given as a not empty string
at /Users/syg/Repos/example/node_modules/sequelize/node_modules/toposort-class/toposort.js:37:31
at Array.forEach (native)
at Toposort.self.add (/Users/syg/Repos/example/node_modules/sequelize/node_modules/toposort-class/toposort.js:35:22)
at /Users/syg/Repos/example/node_modules/sequelize/lib/model-manager.js:89:12
at Array.forEach (native)
at ModelManager.forEachModel (/Users/syg/Repos/example/node_modules/sequelize/lib/model-manager.js:58:15)
at /Users/syg/Repos/example/node_modules/sequelize/lib/sequelize.js:862:23
at tryCatcher (/Users/syg/Repos/example/node_modules/sequelize/node_modules/bluebird/js/main/util.js:24:31)
at Promise._settlePromiseFromHandler (/Users/syg/Repos/example/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:454:31)
at Promise._settlePromiseAt (/Users/syg/Repos/example/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:530:18)
at Promise._settlePromiseAtPostResolution (/Users/syg/Repos/example/node_modules/sequelize/node_modules/bluebird/js/main/promise.js:224:10)
at Async._drainQueue (/Users/syg/Repos/example/node_modules/sequelize/node_modules/bluebird/js/main/async.js:182:12)
at Async._drainQueues (/Users/syg/Repos/example/node_modules/sequelize/node_modules/bluebird/js/main/async.js:187:10)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/syg/Repos/example/node_modules/sequelize/node_modules/bluebird/js/main/async.js:15:14)
at processImmediate [as _immediateCallback] (timers.js:358:17)
I'm using sequelize@3.2.0
with HapiJS
. An similar repo can be found here. (This repo is indeed working, even with sequelize
upgraded to latest version)
It's caused by a illformed self-referencing key in one one of my model file.