Search code examples
firebasegoogle-cloud-firestore

Firestore database data lost problem(The caller does not have permission to execute the specified operation)


In the last 12 hours, I lost some data in Firestore Database. Did you encounter such a situation? What do you think?

2 days ago there was some problems in Firebase servers.

In flutter firebase, I get the error: [cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation

May it be related with this problem? What do you think? How can I bring my 12 hours data?


Solution

  • I was not using Firebase Transactions. When multiple users was updating same value at the same time I was encountering this problem. It seemed like that I lost data but not, I just implemented my code wrongly.

    For counters in Firebase, we should use Firebase Transactions to prevent such a problems.

    Using Firebase Transactions will solve my problem I think.

    Solution: https://firebase.google.com/docs/firestore/manage-data/transactions?hl=en