I have an app for my school. There are some features, but they have not functionalities. I mean students or users, do not write anything. They just read posts, they read bus times etc. Although this, firebase gives an error. Firstly I used
allow read write: if true
but I know it is not safe. So What should I do here? I did request.auth != null because you know my app has not any authentication. So users can't write anything. Although this, firebase gives this error:
Status{code=CANCELLED, description=Disconnecting idle stream. Timed out waiting for new targets., cause=null}.
My firebase rules section:
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if request.auth != null;
}
}
}
error message :
W/Firestore( 6365): (23.0.4) [Firestore]: Listen for Query(target=Query(users/h0m3_p4g3_ order by name);limitType=LIMIT_TO_FIRST) failed: Status{code=PERMISSION_DENIED, description=Missing or insufficient permissions., cause=null}
the code from your app that generates that error: (method_channel_document_reference.dart)
@override
Future<DocumentSnapshotPlatform> get(
[GetOptions options = const GetOptions()]) async {
try {
final Map<String, dynamic>? data = await MethodChannelFirebaseFirestore
.channel
.invokeMapMethod<String, dynamic>(
'DocumentReference#get',
<String, dynamic>{
'firestore': firestore,
'reference': this,
'source': getSourceString(options.source),
},
);
return DocumentSnapshotPlatform(firestore, _pointer.path, data!);
} catch (e) {
throw convertPlatformException(e);
}
}
here when I start the app, it moves catch part of the this code. Throw convertPlatformException(e);