Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloud Call Error when querying documents through GeoFlutterFire #199

Open
mashoodChishti opened this issue Dec 3, 2022 · 0 comments
Open

Comments

@mashoodChishti
Copy link

When querying documents from GeoFlutterFire it returns the following error
`I/flutter (20321): Cloud call error!

I/flutter (20321): Code: internal

I/flutter (20321): Details: null

I/flutter (20321): Message: INTERNAL`

I'm querying it through the following method
StreamBuilder<List<PetAdsRecord>>( stream: queryLocationPetAdsRecord( location: currentUserLocationValue, queryBuilder: (petAdsRecord) => petAdsRecord .where( 'ad_status', isEqualTo: 'Active', ) .orderBy('create_date', descending: true), limit: 15, ), builder: (context, snapshot){ ......

then
Stream<List<PetAdsRecord>> queryLocationPetAdsRecord( {Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false, LatLng? location}) => queryLocationCollection( location!, PetAdsRecord.collection, PetAdsRecord.serializer, queryBuilder: queryBuilder, limit: limit, singleRecord: singleRecord, );
here I use GeoFlutterFire to get snapshot of the documents
Stream<List<T>> queryLocationCollection<T>( LatLng location, Query collection, Serializer<T> serializer, {Query Function(Query)? queryBuilder, int limit = -1, bool singleRecord = false}) { final builder = queryBuilder ?? (q) => q; var query = builder(collection); if (limit > 0 || singleRecord) { query = query.limit(singleRecord ? 1 : limit); } return geo .collection(collectionRef: query as Query<Map<String, dynamic>>) .within( center: GeoFirePoint( location.latitude, location.longitude, ), radius: FFAppState().userAdRadius.toDouble(), field: "location", ) .handleError((err) { print('Error querying $collection: $err'); }).map((s) => s .map( (d) => safeGet( () => serializers.deserializeWith(serializer, serializedData(d)), (e) => print('Error serializing doc ${d.reference.path}:\n$e'), ), ) .where((d) => d != null) .map((d) => d!) .toList()); }
I've added the index on my firestore and checked the structure of all documents and it is correct. if you can help me point out the issue or error in my code do let me know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant