skip to Main Content

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:"[email protected]" 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.

2

Answers


  1. Chosen as BEST ANSWER

    Received confirmation from Firebase team that scheduled functions are currently not available in 2nd generation cloud functions as of now.


  2. Firebase Extensions does not currently support 2nd generation Cloud Functions.

    Cloud tasks could be an alternative in the meantime, but this would depend on your requirements and reasoning for upgrading to 2nd gen:

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

    Source: https://firebase.google.com/docs/functions/task-functions?gen=1st#writing_task_queue_functions

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search