Flutter app in production is not writing data to firebase anymore

Viewed 25

I have a Flutter app in production, he was working well in debug mode. I could write data to firebase without any issue. When released to production, I also could read and write to firebase. Suddenly, the app is not behaving well anymore, when I post data to firebase, it is not writing any data at all but when I modified data directly from firebase, it gets updated in the app. Anybody can help me with this issue?

1 Answers

This might be because of the temporary Cloud Firestore rules you have set up in the beginning.

Go to Firebase -> Firestore Database -> Rules;

enter image description here

in here you should be able to see the restrictions to who can write or read from your Firestore databse, or until when your users can write/read to your database.

If you just want authenticated users to Read&Write whenever they want you can use this sample;

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}

If you want to create a custom rule you can check the Cloud Firestore Security documentation.

Related