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



我成功地使用在特定的服务器位置部署了我的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) => {

我收到:

类型错误:functions.pubsub.sschedule(…(.reregion不是函数

我想知道这个功能(定义自定义部署区域(是否不适用于计划的功能。。。

(btw部署调度功能在没有.region()参数的情况下工作(

.region()存在于导入的functionsSDK本身上,而不存在于.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) => {
})

最新更新