2016年3月25日 星期五

[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
  at [object Object].Instance.save (/home/tremby/myproject/node_modules/sequelize/lib/instance.js:567:18)
  at [object Object].Model.create (/home/tremby/myproject/node_modules/sequelize/lib/model.js:1824:6)
  at [object Object].HasMany.create (/home/tremby/myproject/node_modules/sequelize/lib/associations/has-many.js:533:29)
  at [object Object].obj.(anonymous function) [as createGameSession] (/home/tremby/myproject/node_modules/sequelize/lib/associations/has-many.js:259:24)
  at done (/home/tremby/myproject/src/app/routes/myroute.coffee:43:10)
  at [object Object].<anonymous> (/home/tremby/myproject/src/app/routes/myroute.coffee:58:7)
  at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
...
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

沒有留言:

張貼留言

Facebook