1

I got this error:

@firebase/firestore: Firestore (9.9.0): Could not reach Cloud Firestore backend. Connection failed 1 times.

after chaning my firebase config from

  apiKey: "SecretApiKey",
  authDomain: "SecretAuthDomain",
  [...]
}

to:

const firebaseConfig = {
  apiKey: process.env.apiKey,
  authDomain: process.env.authDomain,
  [...]
}

also I didnt get this error like 2 days ago or when i was making other project with firebase.

I saw that problem on internet and solution was to change to this:

const firestoreDB = initializeFirestore(firebaseApp, {
  experimentalForceLongPolling: true, // this line
  useFetchStreams: false, // and this line
})

but this doesnt work also for me and i get another error.

mpoweredo
  • 79
  • 7

1 Answers1

0

I had credentials setup in .env file which did show up as appropriate variables. However, What worked for me was putting the credentials in a .js file and use them from there. Also, please do not forget to add the credentials file in .gitignore

Sheraz Ahmed
  • 564
  • 9
  • 29