2
votes

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?

2

2 Answers

1
votes

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.

0
votes

It seems right now that it doesn't trigger onWrite triggers. Just tested simple collection export and import with triggers that writes data to BigQuery. Manual changes to collection triggers onWrite and data is written to BQ. I was using gcloud beta firestore import / export features.