我收到此错误:
[错误:内部]
此doc说: [错误:内部]:内部服务器错误。通常是服务器错误。
我尝试仅从函数中返回email
+ password
,并且确实返回,因此意味着发送参数已正确完成,问题应该出在admin.auth()
中。 / p>
我尝试对函数中的电子邮件和密码进行硬编码,只是从RN调用它,仍然是同样的错误。
云功能包括导入:
const functions = require('firebase-functions');
const admin = require('firebase-admin');
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;
return admin.auth().createUser({
email: email,
emailVerified: false,
password: password,
disabled: false
})
.then(function (userRecord) {
return userRecord.uid;
})
.catch(function (error) {
throw new functions.https.HttpsError('Error creating user', error);
});
});
这就是我从RN代码中调用它的方式:
firebase.app().functions('europe-west3').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)
})