I decided to upgrade my extension to use 2nd generation Cloud Functions. I changed my cloud function from pubsub.schedule
to onSchedule
.
In extensions.yaml I have to define resources.properties.eventTrigger.eventType
. However I am not able to find any hints in the documentation: https://firebase.google.com/docs/extensions/publishers/functions#scheduled
The resources section in my extensions.yaml file.
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
Some eventTypes I have attempted:
- google.pubsub.topic.publish
- google.cloud.pubsub.topic.publish
They have resulted in deployment errors, I guess the type is invalid:
Extensions deploy had errors:
- create 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: The request was invalid: invalid value for attribute 'type' in trigger.event_filters: "name:\"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:\"485153738786-compute@developer.gserviceaccount.com\" destination:{cloud_function:\"gcf-encoded|projects/test-backup-firebase-auth/locations/asia-southeast1/functions/ext-backup-firebase-auth-backupauthusers|invalid\"} labels:{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"}}
Error: Extensions deployment failed.