【问题标题】:firebase deploy to custom region for scheduled functionsfirebase 部署到自定义区域以执行预定功能
【发布时间】:2022-01-05 03:17:48
【问题描述】:

我成功地将我的https.onCall() 云功能部署在特定的服务器位置

functions.region("europe-west6")
.https.onCall((data, context) => ...

但是当我尝试为预定功能指定位置时:

   exports.getItems = functions.pubsub.schedule('0 6 * * *')
  .region("europe-west6")
  .timeZone('Europe/Zurich')
  .onRun(async (context) => {

我收到:

TypeError: functions.pubsub.schedule(...).region 不是函数

我想知道这个功能(定义自定义部署区域)是否不适用于预定功能...

(顺便说一句,在没有 .region() 参数的情况下部署计划函数)

【问题讨论】:

    标签: javascript node.js firebase google-cloud-functions


    【解决方案1】:

    .region() 存在于导入的functions SDK 本身而不是.schedule() 返回的ScheduleBuilder,试试这个:

    exports.getItems = functions.region("europe-west6")
      // after .region(''), similar to the HTTP function
      .pubsub.schedule('0 6 * * *')  
      .timeZone('Europe/Zurich')
      .onRun(async (context) => {
    
      })
    

    【讨论】:

    • 哦,非常感谢!我怎么能错过..
    猜你喜欢
    • 2017-09-20
    • 2019-12-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-22
    • 1970-01-01
    相关资源
    最近更新 更多