firebase 部署到自定义区域以执行预定功能

firebase deploy to custom region for scheduled functions

我成功地使用

在特定服务器位置部署了我的 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() 参数的情况下工作)

.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) => {

  })