Error:FIREBASE FATAL ERROR:Can't determine Firebase Database URL.
I am making a simple messageboard app with react native which is connected to firebase. I am initializing firebase as:
import * as firebase from 'firebase';
var firebaseConfig = {
apiKey: "AIzaSyCwILI7iQP9fs5ElhZrVsCfUVRAfgNgpXU",
authDomain: "messageboard-5b65f.firebaseapp.com",
databaseURL: "https://messageboard-5b65f.firebaseio.com",
projectId: "messageboard-5b65f",
storageBucket: "messageboard-5b65f.appspot.com",
messagingSenderId: "993406520031",
appId: "1:993406520031:web:a56bc0b98453ea8d39776a",
measurementId: "G-SWH7GRQYXM"
};
if (!firebase.apps.length) {
firebase.initializeApp({});
} const database = firebase.database();
But everytime I am getting the error shown below:
Error:FIREBASE FATAL ERROR:Can't determine Firebase Database URL.Be sure to include databaseURL option when calling firebase.initializeApp().
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
You are initializing the Firebase SDK with an empty object: firebase.initializeApp({}). It seems like it should be firebase.initializeApp(firebaseConfig)