onSchedule eventType for Firebase Extension?

x4shl7ld  于 2023-11-21  发布在  其他
关注(0)|答案(2)|浏览(153)

我决定升级我的扩展以使用第二代云函数。我将我的云函数从pubsub.schedule更改为onSchedule
在extensions.yaml中,我必须定义resources.properties.eventTrigger.eventType。然而,我无法在文档中找到任何提示:https://firebase.google.com/docs/extensions/publishers/functions#scheduled
我的extensions.yaml文件中的资源部分。

resources:
  - name: backupauthusers
    type: firebaseextensions.v1beta.v2function
    description: >-
      Scheduled function that will backup Authentication users to Google Cloud Storage bucket.
    properties:
      eventTrigger:
        eventType: <What event type?>
      buildConfig:
        runtime: nodejs18

字符串
我尝试过的一些eventTypes:

  • google.pubsub.topic.publish
  • google.cloud.pubsub.topic.publish

它们导致了部署错误,我猜类型是无效的:
扩展部署有错误:

  • 创建backup-firebase-auth ; RESOURCE_ERROR at /deployments/firebase-ext-backup-firebase-auth/resources/backupauthusers:{“ResourceType”:“gcp-types/cloudfunctions-v2beta:projects.locations.functions”,“ResourceErrorCode”:“400”,“ResourceErrorMessage”:{“code”:400,“message”:“Validation failed for trigger projects/test-backup-firebase-auth/locations/asia-southeast1/triggers/ext-backup-firebase-auth-backupauthusers-424196:请求无效:trigger.event_filters:“name:”中的属性“type "值无效:\“projects/test-backup-firebase-auth/locations/asia-southeast1/triggers/ext-backup-firebase-auth-backupauthusers-424196\”event_filters:{attribute:\“type\”value:\“google.pubsub.topic.publish"} service_account:\”email protected(https://stackoverflow.com/cdn-cgi/l/email-protection) \”destination:{cloud_function:gcf编码|projects/test-backup-firebase-auth/locations/asia-southeast1/functions/ext-backup-firebase-auth-backupauthusers|无效"}标签:{key:\“goog-managed-by\”value:\“cloudfunctions"}"",“status”:“INVALID_ARGUMENT”,“statusMessage”:“Bad Request”,“requestPath”:“https://cloudfunctions.googleapis.com/v2beta/projects/test-backup-firebase-auth/locations/asia-southeast1/functions“,“httpMethod”:“POST”}}

错误:扩展部署失败。

4xrmg8kj

4xrmg8kj1#

Firebase扩展目前不支持第二代云功能。
与此同时,云任务可能是一种替代方案,但这取决于您升级到第二代的要求和理由:

export const myFunction = functions.tasks.taskQueue({
      ...config
    })

字符串
来源:https://firebase.google.com/docs/functions/task-functions?gen=1st#writing_task_queue_functions

lo8azlld

lo8azlld2#

从Firebase团队收到确认,截至目前,第二代云功能中的预定功能目前不可用。

相关问题