I had the same issue using firebase, and I discover that I was initializing the 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 react, And I was calling initializeFirebase() from two different components, but I've decided to call it from the parent component. And now I'm able to query my database, insert records, remove, etc.
Hope this helps someone