Solution :
I had the same issue in the recent past using firebase, and I discovered that I was initializing my firebase twice, example:
function initializeFirebase(){
var config = {
apiKey: "myApiKey",
authDomain: "myAuthDomain",
databaseURL: "myDatabaseUrl",
storageBucket: "myStorageBocket",
messagingSenderId: "idhere"
};
//initialize firebase
firebase.initializeApp(config);
}
In my case I was using the react, And I was calling a initializeFirebase() from two different components, but I have decided to call it only from the parent component. And now I am able to query the database, insert records, remove, can do all the operations on my database..
Hope this helps you in fixing your error.