Angular 8 + @angular/fire onCall 函数没有 CORS header 存在错误

Angular 8 + @angular/fire onCall function no CORS header present error

我在 multi-region 'europe-west' 中有 firebase 托管,在 'europe-west1' 中有 firebase 功能。 onRequest 函数似乎工作正常,但我所有的 onCall 函数都会抛出通用 CORS 错误:

 No 'Access-Control-Allow-Origin' header is present on the requested resource.

日志中没有任何有用信息。

函数示例:

export const ADMIN01AddStaffClaim = functions
    .region('europe-west1')
    .https.onCall((data, context) => {
        if (context.auth) {
            if (context.auth.token.owner !== true) {
                let error = new HttpsError('permission-denied', 'You must be an app owner to add staff claims');
                return { error };
            } else {
                const email = data.email;
                return grantClaim(email, 'staff')
                    .then(() => {
                        return { result: 'Added ' + 'staff' + ' claim to ' + email };
                    })
                    .catch(err => {
                        console.log(err);
                        let error = new HttpsError(
                            'permission-denied',
                            'You must be an app owner to add staff claims'
                        );
                        return { error };
                    });
            }
        } else {
            let error = new HttpsError('permission-denied', 'You must be an app owner to add staff claims');
            return { error };
        }
    });

我试过使用 express 的 cors,但从我在文档中读到的内容来看,它不适用于可调用函数。

编辑:对于删除 angular 标签并添加 javascript 的人,我的代码中到处都是打字稿,这是来自 angular 的问题,通过正常浏览器请求工作。

EDIT2:错误被抛出不是因为实际的 CORS 问题,而是因为我的功能一塌糊涂。

我没有从我的函数中正确返回内容,而且似乎默认情况下 CORS 错误是浏览器发出 OPTIONS 请求时的第一个失败点。如果不是因为 CORS 错误,当我调用函数时它会是一个实际的 500 内部服务器错误。