Skip to content

Latest commit

 

History

History
24 lines (15 loc) · 1.33 KB

File metadata and controls

24 lines (15 loc) · 1.33 KB

Periodically delete unused accounts

This sample demonstrates how to delete the accounts of users who have not signed-in in the last month.

Functions Code

See the file functions/index.js for the code.

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 for more information.

The dependencies are listed in functions/package.json.

Deploy and test

To set up the sample:

  • Create a Firebase Project using the Firebase Developer Console
  • Download this sample e.g. git clone https://github.com/firebase/functions-samples
  • Enter the sample directory cd functions-samples/delete-unused-accounts-cron
  • Setup the sample with your project firebase use --add and follow the instructions.
  • Install node dependencies of your Functions cd functions; npm install; cd -
  • Deploy your project using firebase deploy.
  • 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.