【发布时间】:2019-06-20 17:56:12
【问题描述】:
我构建了几个像这样的云功能:
const addRoom = functions.https.onCall((data, context) => {
效果很好,但我想将区域更改为欧洲西部。我关注了这个stackoverflow:firebase deploy to custom region (eu-central1)
const addRoom = functions.region('europe-west1').https.onCall((data, context) => {
它看起来适用于所有函数(触发器)onCall 函数除外。在客户端调用 addRoom 函数时出现此错误:
firebase.functions().httpsCallable("addRoom")(data)
访问获取 'https://us-central1-myproject.cloudfunctions.net/addRoom' 来自原点 'http://localhost:4200/new-room' 已被 CORS 策略阻止: 对预检请求的响应未通过访问控制检查: 预检请求不允许重定向。
目前我为 onCall 函数使用默认区域,但有没有办法纠正这个问题,或者这是来自 firebase 的错误?
【问题讨论】:
标签: firebase google-cloud-functions