I'm using firebase functions to run the code for my flutter app. That sends a push notification to my app. I want to get the token. But I'm getting null value at snap.val(). Here how my code looks like:
const functions = require('firebase-functions');
var admin = require("firebase-admin");
admin.initializeApp();
var db = admin.database();
exports.CreateTicket = functions.firestore
.document('tickets/{username}')
.onCreate((snapshot, context) => {
console.log(snapshot.data().clientUid);// this one working fine.
var ref = db.ref("token/BX3jXKVpOkRa80SIKb7jPwfbU0c2/");
ref.once("value", (snap) => {
console.log(snap.val()); // this one getting null,
});
});
