jm07
jm07

Reputation: 59

Issue with returning a query from firestore

Why is a return statement necessary to read data from firestore? When I use let userRef.get()... nothing is printed to the console.

Thanks.

Upvotes: 0

Views: 68

Answers (1)

Bergi
Bergi

Reputation: 664444

In a google cloud function, you need to return a promise for the result of your function. If you do something asynchronous (like reading from firestore) and do not return the appropriate promise, the runner kills your function before it has finished.

Upvotes: 3

Related Questions