node-asana
node-asana copied to clipboard
Bluebird Array Issue
Unhandled rejection TypeError: expecting an array, a promise or a thenable
See http://goo.gl/s8MMhc
at MappingPromiseArray.init [as _init$] (/home/pubuser/www/node_modules/asana/node_modules/bluebird/js/main/promise_array.js:42:27)
at Promise._settlePromiseAt (/home/pubuser/www/node_modules/asana/node_modules/bluebird/js/main/promise.js:579:21)
at Promise._settlePromises (/home/pubuser/www/node_modules/asana/node_modules/bluebird/js/main/promise.js:697:14)
at Async._drainQueue (/home/pubuser/www/node_modules/asana/node_modules/bluebird/js/main/async.js:123:16)
at Async._drainQueues (/home/pubuser/www/node_modules/asana/node_modules/bluebird/js/main/async.js:133:10)
at Immediate.Async.drainQueues [as _onImmediate] (/home/pubuser/www/node_modules/asana/node_modules/bluebird/js/main/async.js:15:14)
at processImmediate [as _immediateCallback] (timers.js:358:17)
client.users.me()
.then(function(user) {
return client.tasks.findByProject(projectId);
})
.then(function(response) {
try{
console.log("Got Response");
tasks = response.data;
console.log(tasks);
return;
}catch(e){}
})
.filter(function(data) {
console.log("In Filter");
return ;
})
.then(function(list) {
console.log("List");
return;
});
Got Response [ { id: 62477966911872, name: 'Test Task 2' }, { id: 62477966911869, name: 'Test Task' } ]
I think this is because your second closure (which logs "Got Response") does not return the tasks. Instead, it returns undefined. This is what's passed to the third filter closure and probably causing this error.