50Fifty
50Fifty

Reputation: 101

onSchedule eventType for Firebase Extension?

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:

They have resulted in deployment errors, I guess the type is invalid:

Extensions deploy had errors:

Error: Extensions deployment failed.

Upvotes: 2

Views: 128

Answers (2)

50Fifty
50Fifty

Reputation: 101

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

Upvotes: 0

Darren Ackers
Darren Ackers

Reputation: 183

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

Upvotes: 1

Related Questions