You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Firebase扩展升级至Cloud Functions v2后onSchedule的eventType配置问题

解决Firebase扩展升级第二代Cloud Functions定时触发器eventType配置问题

问题核心

将Firebase扩展的云函数从pubsub.schedule迁移到第二代Cloud Functions的onSchedule时,extensions.yaml中eventTrigger.eventType的正确值无法从官方文档找到,尝试google.pubsub.topic.publish和google.cloud.pubsub.topic.publish均触发部署错误,提示触发器的event_filters中type属性值无效。

正确配置方案

第二代Cloud Functions的定时触发器对应的事件类型是**google.cloud.scheduler.job.execute**,同时需要在eventTrigger中补充schedule参数定义定时规则。

修正后的resources配置片段:

resources:
  - name: backupauthusers
    type: firebaseextensions.v1beta.v2function
    description: >-
      Scheduled function that will backup Authentication users to Google Cloud Storage bucket.
    properties:
      eventTrigger:
        eventType: google.cloud.scheduler.job.execute
        schedule: "0 0 * * *" # 示例:每天凌晨执行,替换为你的定时规则
      buildConfig:
        runtime: nodejs18

错误原因说明

之前尝试的google.pubsub.topic.publish是第一代Cloud Functions定时触发器的底层依赖(通过Pub/Sub中转),但第二代Cloud Functions的onSchedule直接绑定Cloud Scheduler服务,因此需要使用Cloud Scheduler对应的事件类型,而非Pub/Sub的事件类型。

内容的提问来源于stack exchange,提问作者50Fifty

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 12:15:57