Jesus Jimenez
Jesus Jimenez

Reputation: 361

How to create a PubSub function that triggers after onWrite function

I wan to create a pubsub function after a function.firestore.onWrite function is triggered, since this last one contains the cron to be specified in the pubsub.schedule(cron).onRun(=>{})

What will be the correct way to wait for the cron time to be created and "deploy" the pubsub function afterwards?, so is created once the cron is known.

Upvotes: 0

Views: 557

Answers (1)

Doug Stevenson
Doug Stevenson

Reputation: 317750

This is not possible. Pubsub triggers do not allow for one-time future units of work to be scheduled at a specific moment in time. They only allows you to set a single schedule strictly adhered to at the time the function was published.

If you want to schedule a single unit of work in the future, you should use Cloud Tasks for that. It can be instructed to trigger an HTTP function at a future time you choose.

See also:

Upvotes: 1

Related Questions