Answer the question
In order to leave comments, you need to log in
Sequelize model crashes on .get?
Hello. Why does it crash when using the Sequelize model.get() library method?
TypeError: instance.get is not a function
at dataValues.(anonymous function).map.instance (D:\Programming\NodeJS\ozzgame2\node_modules\sequelize\lib\model.js:3116:64)
at Array.map (native)
at model.get (D:\Programming\NodeJS\ozzgame2\node_modules\sequelize\lib\model.js:3116:39)
at model.get (D:\Programming\NodeJS\ozzgame2\node_modules\sequelize\lib\model.js:3140:31)
at game.model.save.then (D:\Programming\NodeJS\ozzgame2\modules\coinflip.js:139:32)
at tryCatcher (D:\Programming\NodeJS\ozzgame2\node_modules\bluebird\js\release\util.js:16:23)
at Promise._settlePromiseFromHandler (D:\Programming\NodeJS\ozzgame2\node_modules\bluebird\js\release\promise.js:512:31)
at Promise._settlePromise (D:\Programming\NodeJS\ozzgame2\node_modules\bluebird\js\release\promise.js:569:18)
at Promise._settlePromise0 (D:\Programming\NodeJS\ozzgame2\node_modules\bluebird\js\release\promise.js:614:10)
at Promise._settlePromises (D:\Programming\NodeJS\ozzgame2\node_modules\bluebird\js\release\promise.js:693:18)
at Async._drainQueue (D:\Programming\NodeJS\ozzgame2\node_modules\bluebird\js\release\async.js:133:16)
at Async._drainQueues (D:\Programming\NodeJS\ozzgame2\node_modules\bluebird\js\release\async.js:143:10)
at Immediate.Async.drainQueues (D:\Programming\NodeJS\ozzgame2\node_modules\bluebird\js\release\async.js:17:14)
at runCallback (timers.js:800:20)
at tryOnImmediate (timers.js:762:5)
at processImmediate [as _immediateCallback] (timers.js:733:5)
game.model.save().then(() => {
currentGames[game.model.id] = game;
callback(null, {
roundInfo: game.model.get({ plain: true }) });
}, err => callback(err));
for(let currentGameKey in currentGames) {
if(!currentGames.hasOwnProperty(currentGameKey)) continue;
if(gameId == currentGameKey) {
continuation(currentGames[currentGameKey], false);
break;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question