rakannimer / react-firebase

🔥Declarative React bindings for Firebase Auth & Realtime Database.
https://react-firebase-js.com/
228 stars 33 forks source link

Not obvious what databaseURL in config should be #143

Open robations opened 3 years ago

robations commented 3 years ago

Hi, I'm new to Firebase and just created a web app in Firebase, but React Firebase is asking for databaseURL, which is not given in their copy-config panel. The keys I do have are:

I tried adding a Cloud Firestore, but if this has a databaseURL it's not obvious where I would find it. I'm strongly suspecting this is something they have removed from their API, but React Firebase still thinks it's needed?

Another possibility is I need to create a Realtime Database, but from research so far, I'm not sure this is actually what I want to use.

rohan-deshpande commented 3 years ago

That value is present in your app config in Firebase. Go to the general section of your project settings and view the config, the databaseURL is there.

robations commented 3 years ago

Hi @rohan-deshpande Thanks for the reply. I presume Firebase have changed something because it's not shown in the settings for me. I found some advice on how to construct the URL from the database name and added it manually.

This is what I am given:

const firebaseConfig = {
  apiKey: "xxx",
  authDomain: "xxx.firebaseapp.com",
  projectId: "xxx",
  storageBucket: "xxx.appspot.com",
  messagingSenderId: "xxx",
  appId: "xxx"
};
kua-as-exe commented 3 years ago

Hi @robations. Did you setup the realtime database?

robations commented 3 years ago

@JorgeArreolaS I'm not using realtime. I suspect they now only add this to your config if you've explicitly enabled it.

I guess this might mean the databaseURL key should/could be an optional key? As a Firebase newby I didn't realise databaseURL referred to the Realtime DB, as opposed to the Firebase Store.

davidhughhenrymack commented 3 years ago

I set it to empty string, using Firestore.