I am trying to use the admin sdk to check for a user phone number. when i check for a number in the database, it displays the result, but when i input a number not in the database, it throws an internal error.
below is a sample code of the functions index.js
const functions = require('firebase-functions');
const admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
exports.checkPhoneNumber = functions.https.onCall(async (data, context) => {
const phoneNumber = await admin.auth().getUserByPhoneNumber(data.phoneNumber);
return phoneNumber;
})
front-end.js
toPress = () => {
const getNumberInText = '+12321123232';
const checkPhone = Firebase.functions.httpsCallable('checkPhoneNumber');
checkPhone({ phoneNumber: getNumberInText }).then((result) => {
console.log(result);
}).catch((error) => {
console.log(error);
});
}
below is the error i am getting when i input a number thats not in the auth
- node_modules\@firebase\functions\dist\index.cjs.js:59:32 in HttpsErrorImpl
- node_modules\@firebase\functions\dist\index.cjs.js:155:30 in _errorForResponse
- ... 14 more stack frames from framework internals


