I have a promise chain (bluebird) that breaks up, and I can't figure out why.
Promise.resolve()
.then(function() {
[..]
})
.then(function() {
[..]
})
.then(function() {
[..]
})
.spread(function(instance) {
[..]
})
This fails with TypeError: undefined is not a function
on .spread
. A console.log
on the last .then()
show it returns {}
. Exchanging spread
for then
makes the code run. What am I doing wrong? What would make spread be undefined?
Update: Changing the last spread
to the code below makes it work.
.then(function(arr) {
var instance = arr[0];
[..]
})
I'm an idiot :) missed including bluebird in that file, so it was using the native implementation of promises which doesn't have spread
.