Cloud Functions for Firebase trigger on time? [clo

2018-12-31 02:10发布

I am looking for a way to schedule Cloud Functions for Firebase or in other words trigger them on a specific time.

2条回答
只靠听说
2楼-- · 2018-12-31 02:28

What you can do, is spin up an AppEngine instance that is triggered by cron job and emits to PubSub. I wrote a blog post specifically on that, you might want to take a look:

https://mhaligowski.github.io/blog/2017/05/25/scheduled-cloud-function-execution.html

查看更多
不流泪的眼
3楼-- · 2018-12-31 02:36

There is no built-in runat/cron type trigger yet.

For the moment, the best option is to use an external service to trigger a HTTP function periodically. See this sample in the functions-samples repo for more information. Or use the recently introduced Google Cloud Scheduler to trigger Cloud Functions through PubSub or HTTPS:

enter image description here

I also highly recommend reading this post on the Firebase blog: How to Schedule (Cron) Jobs with Cloud Functions for Firebase and this video: Timing Cloud Functions for Firebase using an HTTP Trigger and Cron.

查看更多
登录 后发表回答