简体   繁体   English

firebase 部署到自定义区域以实现预定功能

[英]firebase deploy to custom region for scheduled functions

I successfully managed to deploy my https.onCall() cloud functions on a specific server location with我成功地将我的https.onCall()云函数部署在特定的服务器位置

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

But when I tried to specify a location for scheduled function:但是当我尝试为预定的 function 指定位置时:

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

I receive:我收到:

TypeError: functions.pubsub.schedule(...).region is not a function类型错误:functions.pubsub.schedule(...).region 不是 function

I wonder if this functionality (defining custom deploy region) is not available for scheduled functions...我想知道这个功能(定义自定义部署区域)是否不适用于预定功能......

(btw deploying the scheduled function worked without the .region() parameter) (顺便说一句,部署计划的 function 在没有 .region .region()参数的情况下工作)

The .region() exists on imported functions SDK itself and not on the ScheduleBuilder returned by .schedule() , try this: .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) => {

  })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM