Skip to content Skip to sidebar Skip to footer

Firebase Functions, Admin.database().ref(...).get() Is Not A Function

I am working on an Android Application and am using firebase as the back end for it. I am trying to get a notification system working that relies on listening to changes in the dat

Solution 1:

It looks like you're mixing up the Realtime Database and Firestore APIs. Firebase Realtime Database APIs doens't provide a get() method to fetch data. For that, you use once() on a Reference object.


Solution 2:

The error is pretty explicit: there is no get function in the a Firebase Realtime Database.

You seem to be trying to use Cloud Firestore, which is available under admin.firestore(). So something like:

 const from_data = admin.firestore().doc("Jobs/" + job_id).get();
 const to_data = admin.firestore().doc("Users/" + user_id).get();

For full samples see the NODE.JS tab in the Getting started and other Firestore documentation.


Post a Comment for "Firebase Functions, Admin.database().ref(...).get() Is Not A Function"