samedi 28 mars 2015

sails js promises - cannot method then of undefined

I have the following code executing inside a controller in Sailsjs. I get the following error back


TypeError: Cannot call method 'then' of undefined


Why is this error occurring?



User.query("select id from User where username='" + req.param("userid") + "'").then(function(userData){
console.log(userData);
return userData;
}).fail(function (err) {
console.log("Handled");
});

Aucun commentaire:

Enregistrer un commentaire