You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: delete-unused-accounts-cron/README.md
+2-31
Original file line number
Diff line number
Diff line change
@@ -7,37 +7,12 @@ This sample demonstrates how to delete the accounts of users who have not signed
7
7
8
8
See the file [functions/index.js](functions/index.js) for the code.
9
9
10
-
Cloud Functions does not natively supports cron jobs. We are working around this by executing the code as an HTTPS-triggered function. Then simply use an external service to periodically "ping" the URL.
11
-
12
-
Here is a non-exhaustive list of external services for cron jobs:
13
-
-https://cloud.google.com/scheduler/
14
-
-https://cron-job.org/
15
-
-https://www.setcronjob.com/
16
-
-https://www.easycron.com/
17
-
-https://zapier.com/zapbook/webhook/
10
+
**Note:** This function uses Cloud Scheduler and Pub/Sub, which can have associated costs. Your project must be on the Blaze payment plan as these features require billing information. See the [Cloud Scheduler pricing page](https://cloud.google.com/scheduler/pricing) for more information.
18
11
19
12
The dependencies are listed in [functions/package.json](functions/package.json).
20
13
21
-
22
-
## Trigger rules
23
-
24
-
The function triggers when the HTTP URL of the Function is requested.
25
-
26
-
27
14
## Deploy and test
28
15
29
-
Set the `cron.key` Google Cloud environment variables to a randomly generated key. This will be used to authorize requests coming from the 3rd-party cron service. For this use:
30
-
31
-
```bash
32
-
firebase functions:config:set cron.key="YOUR-KEY"
33
-
```
34
-
35
-
You can generate a random key, for instance, by running:
- Create a Firebase Project using the [Firebase Developer Console](https://console.firebase.google.com)
@@ -46,8 +21,4 @@ To set up the sample:
46
21
- Setup the sample with your project `firebase use --add` and follow the instructions.
47
22
- Install node dependencies of your Functions `cd functions; npm install; cd -`
48
23
- Deploy your project using `firebase deploy`.
49
-
- Open an account with a 3rd party cron service (e.g. www.setcronjob.com, cron-job.org, www.easycron.com, [Zapier](https://zapier.com/zapbook/webhook/) ...) and setup a daily cron job to hit the URL (don't forget to change `<YOUR-KEY>` and `<PROJECT-ID>`):
- The pubsub task should then run once a day and delete any inactive users. You can manually run the task by [navigating to Cloud Scheduler in the Google Cloud Platform Console](https://console.cloud.google.com/cloudscheduler).
0 commit comments