我正在尝试从我的应用中调用可调用的Cloud Function,但是我遇到了CORS问题。

由于无法访问onCall函数的请求和响应,因此无法启用Cors。这是我的功能:
exports.UserInvitation = functions.https.onCall((data, context) => {
const email = data.email
return new Promise((resolve, reject) => {
admin.auth().createUser({
email: email,
emailVerified: false,
password: password
}).then(resolve).catch((err) => {
console.error(err.code)
reject(new functions.https.HttpsError(err.code, err.message))
})
})
})
Run Code Online (Sandbox Code Playgroud)
这就是我所说的:
functions.httpsCallable('UserInvitation')({ email: this.input.value }).then((data) => {
console.log('Sent invitation:', data)
})
Run Code Online (Sandbox Code Playgroud)
Firebase功能package.json:
{
"name": "functions",
"description": "Cloud Functions for Firebase",
"scripts": {
"serve": "firebase serve --only functions",
"shell": "firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"dependencies": …Run Code Online (Sandbox Code Playgroud)