Issue
I'm developing a schedule function for my Firebase project. The function will read data from Firebase RTDB. However, I've been getting a Client is offline error in the function logs. Is there any way I can solve this problem? I've tried including and excluding queries. Here's the code:
firebase.database("some link here")
.ref().child("ticket").get().then((value) => {
value.forEach((element) => {
console.log(element.key);
})
});
I've tried looking for solutions, but still haven't managed to find one. Any help will be appreciated. Thanks :D
Solution
firebaser here
I've recently seen some people having this problem and from my testing it seem to happen when the client hasn't been able to establish a connection yet when you first call get().
Until a fix is available, the best workaround is to call once() which is pretty much the same on Cloud Functions and on other JavaScript environments anyway.
Also see: Firebase .get() vs .once() - What is the difference?
Answered By - Frank van Puffelen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.