'Unexpected getting cloud_firestore/permission-denied in production sometimes
My Firestore rule:
match /app/info {
allow read;
}
My code:
FirebaseFirestore.instance
.collection('app')
.doc('info')
.snapshots()
.listen(
(event) {
final _minVersion = event.data()?['min_version'];
if (_minVersion is! String) return;
shouldUpdateApp(Version.parse(_minVersion), context.appLoc);
},
onError: (Object error, StackTrace? stackTrace) {
FirebaseCrashlytics.instance.recordError(
error,
stackTrace,
reason: 'app info onError',
);
},
)
And is working perfectly in development.
However, sometimes in production I get errors reported to Firebase Crashlytics.
Non-fatal Exception: io.flutter.plugins.firebase.crashlytics.FlutterError
[cloud_firestore/permission-denied] The caller does not have permission to execute the specified operation.. Error thrown app info onError.
Update 18 May 2022:
This only happens when the device is 100% running in background.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|