【发布时间】:2025-12-13 05:55:01
【问题描述】:
当我从我的 React-Native 应用程序调用该函数时,它会抛出此错误:[Error: NOT_FOUND]。
我对其进行了研究,根据 Firebase 文档,这意味着:“找不到指定的资源,或者请求因未公开的原因被拒绝,例如白名单。”
这是整个控制台日志消息:
[05:51:32] 我 | ReactNativeJS ▶︎'错误处理',{ [错误:NOT_FOUND] │ 线路:26115, │ 栏目:28, └ sourceURL: 'http://localhost:8081/index.bundle?platform=android&dev=true&minify=false' }
React-Native 代码:
firebase.functions().httpsCallable('registerNewPatient')({
email: 'bimiiix@hotmail.com',
password: 'bbbbbb1'
}).then((onfulfilled, onrejected) => {
if (onfulfilled) {
console.log("OK callback function:", onfulfilled);
} else {
console.log("Error callback function:", onrejected)
}
}).catch(error => { console.log("ERror handled", error) })
云功能:
exports.registerNewPatient = functions.region('europe-west3').https.onCall((data, context) => {
if (!data.email) throw "Missing email parameter";
if (!data.password) throw "Missing password parameter";
const email = data.email;
const password = data.password;
admin.auth().createUser({
email: email,
emailVerified: false,
password: password,
disabled: false
})
.then(function (userRecord) {
registeredUser = userRecord.uid;
console.log('Successfully created new user:', userRecord.uid);
})
.catch(function (error) {
console.log('Error creating new user:', error);
});
return registeredUser;
});
【问题讨论】:
标签: node.js firebase react-native firebase-authentication google-cloud-functions