Skip to content

Firebase error : failed to get document because the client is offline #5836

Closed
@yunesuk

Description

@yunesuk

[REQUIRED] Describe your environment

  • Operating System version: windows 10
  • Browser version: react native 0.66.4
  • Firebase SDK version: 9.6.1
  • Firebase Product: database , firestore (auth, database, storage, etc)

[REQUIRED] Describe the problem

im using firebase v9 with react native project , it gives me error while trying to get or set data in firestore , my code is valide , the confuse one is auth working fine but firestore gives me error that my device is not connected to network intenet , i tested it in my real
device and android emulator it gives me the same error from wednesday, im stuck in this probleme plead

Relevant Code:

//firebase.js
import {initializeApp} from 'firebase/app';
import {getFirestore} from 'firebase/firestore';
import {getAuth} from 'firebase/auth';

const firebaseConfig = {
  //config here..
};
const app = initializeApp(firebaseConfig);
export const auth = getAuth(app);
export const db = getFirestore(app);


createUserWithEmailAndPassword(auth, email, password)
        .then(userCredential => {
          setDoc(doc(db, 'users', userCredential.uid), {
            username: username,
            email: userCredential.email,
          }).catch(error => {
            Errmsg(error.message);
          });
        })
        .catch(error => {
          Errmsg(error.message);
        });

 //getting data

getDoc(doc(db, 'users', currentUser.uid))
          .then(docSnap => {
            if (docSnap.exists()) {
              console.log('Document:');
            } else {
              console.log('No such document!');  
            }
          })
          .catch(e => {
            console.log(e.message);  
          });

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions