question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

FireStore listener as a service stop working after a day

See original GitHub issue

Version: Google.Cloud.Firestore-1.0.0-beta13

Guys, I am having some issues with FireStore real time updates. I have deployed a web app to Azure Web Site. On a start up, this application subscribes to the updates in the FireStore users table. `

        GoogleCredential googleCredential = googleCredential = GoogleCredential.FromJson(JsonConvert.SerializeObject(secret));
        var channel = new Grpc.Core.Channel(FirestoreClient.DefaultEndpoint.Host,
            googleCredential.ToChannelCredentials());

        FirestoreClient client = FirestoreClient.Create(channel);
        FirestoreDb db = FirestoreDb.Create(projectId: "myproject-2018", client: client);

        CollectionReference collection = db.Collection("users");


        FirestoreChangeListener listener = collection.Listen(async querySnapshot =>
        {
        })

`

All works perfect, but after a couple hours, or sometimes days, it just stop receiving updates without any errors. Is there any way for me to debug it to understand why?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:44

github_iconTop GitHub Comments

2reactions
jskeetcommented, Dec 18, 2018

I saw a failure yesterday and this morning which was unrelated (and which I’ve asked about internally). I could merge my expected fix in and do another release today; I don’t believe it’s harmful, and it would let others test over Christmas.

1reaction
pauloevprcommented, Dec 7, 2018

I have a similar issue. I am running an Asp.Net Core 2.1 Web API on Google Cloud App Engine. The FirestoreListener stops working eventually. I can’t say it is precisely after 24 hours. It seems just random.

From my analysis so far, it seems to be an issue with Firestore backend rather than the Firestore .NET SDK. Firestore randomly fails when reading/writing documents. It is not just about the listeners.

For example. Yesterday my Asp.Net Core Web API had the following exception when getting a document snapshot:

Grpc.Core.RpcException: Status(StatusCode=PermissionDenied, Detail=“Missing or insufficient permissions.”)

I have seen this at least once every month.

That is not the only one. I also have this one randomly once in a while when reading documents:

Grpc.Core.RpcException: Status(StatusCode=Unavailable, Detail=“The datastore operation timed out, or the data was temporarily unavailable.”)

My conclusion is that, as a beta product, it is possible that Firestore backend randomly fails to serve requests for whatever reason.

For the specific listener issue, my workaround is to have a function triggered by a timer which will restore the listener as required.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Do Firestore listeners run indefinitely as long as the app is ...
1 Answer 1 ... if the user is idle but never goes offline, will the listener keep working indefinitely? Yes, as long as...
Read more >
Getting real-time updates | Firestore
By default, listeners are not notified of changes that only affect metadata. Consider what happens when your app writes a new document:.
Read more >
Usage and limits | Firestore - Firebase
The following tables show the limits that apply to Cloud Firestore. These are hard limits unless otherwise noted. Collections, documents, and fields. Limit ......
Read more >
How to fix Firestore Error: PERMISSION_DENIED
A simple solution for handling Firestore error. · A class of exceptions thrown by Cloud Firestore. · public static final ...
Read more >
Event listener not working with firebase query
Hi, I am trying to create an event listener to my firebase query script but it acts a little strange?!? Here is my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found