[fixed] Sequelize: warning: "a promise was created in a handler but was not returned from it"

Sequelize: warning: “a promise was created in a handler but was not returned from it”

problem:

when running sequelize, and console display error message below, accroding to sequelize issues, the information dose not effect anything about process.

Warning: a promise was created in a handler but was not returned from it<br></br> at [object Object].Instance.save (/home/tremby/myproject/node_modules/sequelize/lib/instance.js:567:18)<br></br> at [object Object].Model.create (/home/tremby/myproject/node_modules/sequelize/lib/model.js:1824:6)<br></br> at [object Object].HasMany.create (/home/tremby/myproject/node_modules/sequelize/lib/associations/has-many.js:533:29)<br></br> at [object Object].obj.(anonymous function) [as createGameSession] (/home/tremby/myproject/node_modules/sequelize/lib/associations/has-many.js:259:24)<br></br> at done (/home/tremby/myproject/src/app/routes/myroute.coffee:43:10)<br></br> at [object Object].<anonymous> (/home/tremby/myproject/src/app/routes/myroute.coffee:58:7)<br></br> at processImmediate [as _immediateCallback] (timers.js:383:17)<br></br>From previous event:<br></br>...

but it is still buggy,

solution

it is simple, if you are running code as development, please setup NODE_ENV for yourself.
then it works.

export NODE_ENV=development

Ref,

https://github.com/sequelize/sequelize/issues/4883

CaesarChi

Web developer, focus on website fullstack, special JavaScript, and love sharing developing experience and communicate with developers. http://about.me/clonn