1

I am using theme bought from themeforest. Authentication with firebase is fine but when I try to store and get data from firestore it gives me this error.

Failed to get document because the client is offline.

And I have internet connection

this is configuration file.

import firebase from "firebase/compat/app";
import 'firebase/compat/auth';
import 'firebase/compat/firestore';

const config = require("./app_config.json")


// Firebase 
export const firebase_app = firebase.initializeApp({

    apiKey: config.firebase.apiKey,
    authDomain:config.firebase.authDomain,
    databaseURL: config.firebase.databaseURL,
    projectId: config.firebase.projectId,
    storageBucket: config.firebase.storageBucket,
    messagingSenderId: config.firebase.messagingSenderId,
    appId:config.firebase.appId,


});

export const googleProvider = new firebase.auth.GoogleAuthProvider();
export const facebookProvider = new firebase.auth.FacebookAuthProvider();
export const twitterProvider = new  firebase.auth.TwitterAuthProvider();
export const githubProvider = new  firebase.auth.GithubAuthProvider();
export const db =  firebase.firestore();

db.collection('todo').doc('v4cAs4IzGXXRttpYKvjk').get().then((snap)=>{
    console.log('DB',snap.docs)
}).catch((err)=>{
console.log(err)
})


in catch() it is giving me this error.

Uncaught (in promise) FirebaseError: Failed to get document because the client is offline.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
web pakistan
  • 444
  • 1
  • 4
  • 16

0 Answers0