Unhandled rejection TypeError: Dependency name must be given as a not empty string

1,517 views
Skip to first unread message

Zach Guo

unread,
Jun 7, 2015, 8:53:15 PM6/7/15
to sequ...@googlegroups.com

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 sequ...@3.2.0 with HapiJS. An similar repo can be found here. (This repo is indeed working, even with sequelize upgraded to latest version)

Original Stackoverflow Page

Mick Hansen

unread,
Jun 8, 2015, 3:25:05 AM6/8/15
to Zach Guo, sequ...@googlegroups.com
Afraid i haven't seen that specific error before, can you give us a bit more info?
--
Mick Hansen
@mhansendev
mhansen.io

Jan Aagaard Meier

unread,
Jun 17, 2015, 11:34:47 AM6/17/15
to sequ...@googlegroups.com
The error is happening in toposort.js, which we use to figure out in what order to synchronize models. Do you perchance have any models with an empty string as name?
Reply all
Reply to author
Forward
0 new messages