I am trying to retrieve a large amount of data from production using this method but getting the following error: (Dot Net Core application) I also found a related report made in 2021 but it is closed with unknown resolution.
Grpc.Core.RpcException: Status(StatusCode=“Internal”, Detail=“Error reading next message. InvalidDataException: Unexpected end of content while reading the message content.”, DebugException=“System.IO.InvalidDataException: Unexpected end of content while reading the message content.”)
—> System.IO.InvalidDataException: Unexpected end of content while reading the message content.
at Grpc.Net.Client.Internal.StreamExtensions.ReadMessageContentAsync(Stream responseStream, Memory1 messageData, Int32 length, CancellationToken cancellationToken) at Grpc.Net.Client.Internal.StreamExtensions.ReadMessageAsync[TResponse](Stream responseStream, GrpcCall call, Func2 deserializer, String grpcEncoding, Boolean singleMessage, CancellationToken cancellationToken)
at Grpc.Net.Client.Internal.GrpcCall2.ReadMessageAsync(Stream responseStream, String grpcEncoding, Boolean singleMessage, CancellationToken cancellationToken) at Grpc.Net.Client.Internal.HttpContentClientStreamReader2.MoveNextCore(CancellationToken cancellationToken)
— End of inner exception stack trace —
at Grpc.Net.Client.Internal.HttpContentClientStreamReader2.MoveNextCore(CancellationToken cancellationToken) at Google.Cloud.Firestore.FirestoreDb.<GetDocumentSnapshotsAsync>b__38_0(BatchGetDocumentsRequest req, CallSettings settings) at Google.Cloud.Firestore.RetryHelper.Retry[TRequest,TResponse](RetrySettings retrySettings, Func3 fn, TRequest request, CallSettings callSettings, IClock clock, IScheduler scheduler)
at Google.Cloud.Firestore.FirestoreDb.GetDocumentSnapshotsAsync(IEnumerable1 documents, ByteString transactionId, FieldMask fieldMask, CancellationToken cancellationToken) at Google.Cloud.Firestore.FirestoreDb.GetAllSnapshotsAsync(IEnumerable1 documents, ByteString transactionId, FieldMask fieldMask, CancellationToken cancellationToken)
based on the nature of this error, I strongly feel like it is fetching part of the data for whatever reason and that is why I see “Error reading next message. InvalidDataException: Unexpected end of content while reading the message content.” Seems like either Firestore timeout or this API can pull only certain number records during debugging? Anyone has any clue? It has no problems when deployed to GCP and everything works just fine but only while debugging is the issue.
The referencing code that produces above error is this:
var documentReferences = await firestoreDb.Collection(COLLECTIONNAME).ListDocumentsAsync().ToListAsync();
var fieldMask = new FieldMask(“test”);
var documentSnapshot = await firestoreDb.GetAllSnapshotsAsync(documentReferences, fieldMask); – it is failing right here
Another incident: In another case, I know one of our collections had way over 4k documents but while debugging it only fetches less than half of the data resulting in my filters do not find the data I am looking for.
The referencing code for this incident is:
CollectionReference colRef = firestoreDb.Collection(collectionName).Document(sortDate)
.Collection(COLLECTIONNAME).Document(document).Collection(COLLECTIONNAME1);
var snapshot = colRef.GetSnapshotAsync().GetAwaiter().GetResult(); - This does not throw any error but returns only partial data while debugging resulting in unable to find the root cause of the issue(s) reported by the end users while debugging. However, in GCP all the data is returning as expected when we look at the logs. For example: Pointing to Production from local machine and debugging only returns 1866 records but in GCP log we see more than 4k records/documents returned. That said, is there any limitation on FirestoreDb API while debugging? If so, how can we over come with this issue so that we can troubleshoot efficiently?