Failed to get document because the client is offline.

See original GitHub issue

I am trying to develop an android app using nativescript and firebase as backend.To use Firebase I am using this plugin. I am trying to use Firestore for my app .I get this error each time I try to start the app.When I used realtime database ,I was easily able to access all the data, so this is not a network or configuration issue. Below is the code I am using to connet firebase and use firestore.

 firebase.initializeApp({}).then((data)=>{
           console.log(data) //it prints the databaseURL and it is correct.
        });
        var db = firebase.firestore();
        db.collection("users").doc('<docKey>').get().then((doc) => {
            if (doc.exists) {
                this.data =doc.data();
            } else{
                this.data ="No such document!";
            }
        }).catch((error) => {
            console.log(error);
        });

Error : com.google.firebase.firestore.FirebaseFirestoreException: Failed to get document because the client is offline.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:25 (5 by maintainers)

github_iconTop GitHub Comments

5reactions
jacopo69commented, Aug 29, 2018

Simply check if you have permissions to access your document. In my case I forgot to set the read permission:

match /channels/{channel} {
     allow read: if request.auth.uid != null;
    }
Read more comments on GitHub >

github_iconTop Results From Across the Web

firestore Failed to get document because the client is offline ...
Yes it's the normal behaviour to get an error with get on a collection if the service could not be reached (when online...
Read more >
Firebase Cloud Firestore throws "client is offline"
Auth, Realtime DB and Storage work perfectly fine. Failed to get document because the client is offline. Error. Is there something I can...
Read more >
Failed to get document because the client is offline.
W/Firestore(25403): This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline...
Read more >
[code=unavailable]: Failed to get document because the client ...
The error I keep getting is: FirebaseError: [code=unavailable]: Failed to get document because the client is offline. I have no idea what I...
Read more >
"FirebaseError: failed to get document because the client is ...
I'm working on an Ionic-App with multiple tabs. When I run the app in the browser using ionic serve everything runs as it...
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