Skip to content Skip to sidebar Skip to footer

Firebase Database Trigger - How To Wait For Calls

I am having trouble making asynchronous operations in firebase database functions. I have tried the code below exports.onTodoCreate = functions .region('europe-west1') .database .r

Solution 1:

on() attaches a persistent listener to a query that will get invoked with the data at that location, and again for each change to any data at that location. The method does not return a promise. This is almost certainly never what you want to do in Cloud Functions.

Instead, if you need to get data a single time, use once(), which returns a promise that resolves with a snapshot of the requested data.

Post a Comment for "Firebase Database Trigger - How To Wait For Calls"