var firebase = require('firebase-admin');
const serviceAccount = require('./admin-key.json');
firebase.initializeApp({
credential: firebase.credential.cert(serviceAccount),
databaseURL: 'https://xxxxxx.firebaseio.com/'
});
exports.handler = async (event, context, callback) => {
var db = firebase.database();
var ref = db.ref(`users/${event.userID}`);
const snapshot = await ref.once('value');
console.log(snapshot.val())
callback(null, snapshot.val());
context.succeed();
};
I'm getting the snapshot variable coming up on the logs, but the function does not return any data, just times out after the maximum time limit. Any idea how to get it working for NodeJS 14.x?