区域欧洲未触发firebase云功能firestore

时间:2018-08-14 17:49:23

标签: firebase google-cloud-firestore google-cloud-functions

我正在测试Firebase云功能的新区域设置,这是不对的(我可能做错了)。

由于我们的用户在欧洲,所以我想将我的所有项目和职能移至欧洲。 Https函数按预期工作,只需设置以下内容即可:

export const test = region('europe-west1').https.onRequest(....)

另一方面,我在使用firebase触发器时遇到了麻烦。虽然此功能可以正常工作:

export const firebaseUpdateTrigger =  region('us-central1')
.firestore
.document(...)
.onUpdate(...) 

不会触发相同的代码:

export const firebaseUpdateTrigger =  region('europe-west1')
.firestore
.document(...)
.onUpdate(...) 

我做错了什么?

我正在使用以下版本:

“ firebase-functions”:“ 2.0.4”,

“ firebase-admin”:“ 5.13.1”,

“ @ google-cloud / firestore”:“ ^ 0.15.0”

3 个答案:

答案 0 :(得分:1)

您可能已经错过了一些更改功能区域的必要步骤,即:

  1. 重命名功能,并更改其区域。
  2. 部署重命名的函数,这会导致两个区域中暂时运行相同的代码。
  3. 删除上一个功能

您可以从“管理功能部署和运行时选项”在线文档的“更改功能区域” sub-chapter中收集更多详细信息。

答案 1 :(得分:0)

嘿,@ Borja Gorriz

我刚刚遇到了类似的问题,这个问题对我来说很有效:

exports.onTest2 = functions.region('europe-west2').firestore
    .document('/mycollection/{documentID1}')
    .onUpdate((change, context) => {
      console.log('test all right');
    });

成功部署:

screenshot

答案 2 :(得分:0)

在创建具有相同名称的函数后,我遇到了一个问题,即 onCreate 事件没有被触发。所以,我删除了我不需要的旧功能(在旧区域)。然后我再次部署了。它解决了我的问题。

<块引用>
  1. 删除了旧功能
  2. 重新部署了新功能
相关问题