Search code examples
firebasegoogle-cloud-firestoregoogle-cloud-functions

Firebase: Does importing a firestore database from a previous export trigger Cloud Functions?


I have an app in production with backups scheduled daily using the method described in the firebase docs:

Export all documents from a firestore database

I also have some Cloud Function triggers watching certain collections in the firestore database for onCreate, onUpdate, onWrite and onDelete events.

If I were to import the backup to the same project (to restore data to a previous state) at some point in the future, would the import trigger the cloud function events?


Solution

  • Update from lisek's answer and comment it seems that this behavior changed and that using the import function now no longer triggers Cloud Functions.


    Outdated answer 👇

    Any write operation triggers the Cloud Functions that are configured for your project, including an import of data. There is no feature to disable Cloud Functions for imports.

    The usual workaround is to temporarily deploy an empty function, then perform the import, and finally re-deploy the regular function code. You might want to disable writes by regular users during the time your functions are not active.