return value inside promise chain isn't getting called
I'm using the promise library Bluebird and I'm currently running into the issue that everything inside the function runs great, but when I try to return a value, the function instead returns undefined . This is the promise chain: function foo() { createGroupMembers(parsedChat).then(function(val) { var members = val; createMessages(parsedChat, maxPages).then(function(val) { var messages = val; Promise.all([ createFrontCover(subject, firstdateOfMessages, lastDateOfMessages, isPreview), createStats(parsedChat), createBackCover(parsedChat)]) .then(function (results) { var front = results[0]; var