Reputation: 73
I have to extract data from the user using auth by phone Number. I have an array of user's phone number.
I have written a solution and it gives the required output but it doesn't terminate. How can I solve this problem?
"phoneNumberArray" is the array of user's phone number. It is mostly related to HTTP background trigger functions.I have solved this but this is a firebase issue so please see this
const user = async () => {
const getAuth = async phoneNumber => {
return auth.getUserByPhoneNumber(phoneNumber).catch(() => {
return {
phoneNumber,
uid: null,
email: '',
displayName: '',
emailVerified: false,
disabled: false,
};
});
};
const userRecord = await Promise.all(
phoneNumberArray.map(phoneNumber => {
return getAuth(phoneNumber);
}),
);
//when i console.log(userRecord) it's print the output
const x = {
'userRecord Length': userRecord.length
}
console.log(x)
return;
}
module.exports = {user}
Upvotes: 0
Views: 209
Reputation: 73
I have used this way to solve the function.
in the main file i have to return
return x,admin;
and the calling file works like this
const {user} = require('./filename');
user().then(e => {
console.log(e.x)
e.admin.apps[0].delete();
})catch(error){
console.log(error)}
Upvotes: 1