Asynchronous https firebase functions

Viewed 7059

Should HTTPS functions return asynchronous promises like realtime functions have to? We haven't been returning in HTTPS functions (just using res.status.send etc), and it looks like firebase/function-samples aren't either. But the documentation is slightly ambiguous https://firebase.google.com/docs/functions/terminate-functions .

4 Answers

This works now in the latest Firebase:

exports.asyncFunction = functions.https.onRequest(async (request, response) => {
    const result = await someAsyncFunction();
    response.send(result);
});
Related