1
Hello, I’m trying to access the items contained within a user in firebase’s Altime, but the return of the snapshot is coming empty, does anyone know where the error might be?
const firebaseService = require('./firebaseService');
const {admin, customersDB} = require('./firebaseServices');
const getMd5 = require('./util').getMd5;
@param {string} email
const getUserProfile = (email) =>
new Promise((resolve, reject) => {
try{
const profileRef = admin
.database(customersDB)
.ref(`profiles/${getMd5(email)}`);
profileRef
.once('value')
.then((snapshot) => {
if(!snapshot.exists()){
return reject(new Error('usuário não foi encontrado'));
}
return resolve(snapshot.val());
})
.catch((err) => reject(err));
} catch(error){
return reject(error);
}
});
The return has always been a 'User not found!'.