invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.7k stars 2.22k forks source link

[🐛] ver 10.7.0 firestore permission problem #4900

Closed astroana closed 3 years ago

astroana commented 3 years ago

I was using ver. 9.x.x of firebase and I upgraded all to the latest version 10.7.0, suddenly when I add(), or set() or update(), or delete(), or signOut() I get this error:

firestore/permission-denied] The caller does not have permission to execute the specified operation.

I didn't have any changes in code which works fine before I upgrade. and my firestore rule is like this:

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

    match /collection2/{document=**} {
      allow read, write: if request.auth != null;
    }

    match /collection3/{document=**} {
      allow read, write: if request.auth != null;
    }

  }
}

I have not change my rules for the past 6 months and it was working fine until I upgraded, what could be wrong with my permission why is it not working with the new version even the simple auth().signOut() gives me the same error?

onSnapshot() is also updating very slow, needs to open and close the app multiple times before it fully loads:

RN ver: 0.63.4 platform: Android

astroana commented 3 years ago

nevermind I just went back to the older version for now

"@react-native-firebase/app": "9.0.0",
"@react-native-firebase/auth": "^9.3.5",
"@react-native-firebase/firestore": "^7.10.3",
"@react-native-firebase/messaging": "^8.0.1",
"@react-native-firebase/storage": "^7.4.14",
mikehardy commented 3 years ago

What has changed is likely the version of firebase-ios-sdk and firebase-android-sdk that were brought in, as (usually) mentioned in the release notes. You have moved across a breaking change version (firebase-ios-sdk 6 -> 7 and firebase-android-sdk 25 -> 26) with the version jump you made here in react-native-firebase so you should consult those release notes to see what you need to do.

I believe what you'll need to do is download new google-services.json / plist for your project but the release notes may have other indications as well

Your versions are fairly aged at this point and I have memory of quite a few fixed bugs some of which cause crashes since then, I would not consider the downgrade as more then temporary

astroana commented 3 years ago

Thanks for the advice, I will try that.

brown-qs commented 1 year ago

This issue happens for years but it's still bothering developers.

[Error: [firestore/permission-denied] The caller does not have permission to execute the specified operation.]

My firestore rule:

rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if true; } } }

Firebase SigninWithEmailAndPassword succeeds, but when firestore.collection('users').doc(uid).get() it displays this error.

"@react-native-firebase/app": "^18.5.0",
"@react-native-firebase/auth": "^18.5.0",
"@react-native-firebase/crashlytics": "^18.5.0",
"@react-native-firebase/dynamic-links": "^18.5.0",
"@react-native-firebase/firestore": "^18.5.0",

Thanks in advance