I want to get some data from my firebase real-time database. It worked once but now returns 'Promise {pending}'
const userId = admin.database()
.ref(/dhabba_orders/{userID}).once('value');
The above code returned the correct value once and now only returns 'Promise {pending}'
exports.notificationMake =
functions.database.ref(`/dhabba_orders/{userId}/status`)
.onWrite((change, context) => {
const userId = admin.database()
.ref(`/dhabba_orders/{userID}`).once('value');
console.log(userId);
const payload = {
notification: {
title: `Hi`,
body: `Hey`
}
};
return admin.messaging().sendToDevice(userId, payload);
});