0

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.

Jesus Jimenez
  • 351
  • 1
  • 3
  • 13

1 Answers1

1

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:

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • On Stack Overflow, it's customary to upvote and mark helpful answers as correct using the buttons to the left of the answer. – Doug Stevenson Mar 06 '21 at 04:54