firebase onCall cloud function not returning the results

You are capturing the promises returned by function1 and function2 and trying to send them directly to the client. That’s not going to work. You will need to get their resolved values in the callback on the promise returned by Promise.all().

    return Promise.all([
        function1(),
        function2()
    ])
    .then((result1, result2) => {
        console.log(result1);
        console.log(result2);
        return {
            result1: result1,
            result2: result2
        }
    }) 

Note that you don’t even need to declare result1 and result2 at the higher scope.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top