Error getting firebase documents


I have a collection in firebase which has a few documents. I have a javascript code which connects to this database.

window.onload = inicializar();
var dbRef;
function inicializar() {
    dbRef = firebase.firestore().collection(PRODUCTOS); //dbRef contiene la referencia a mi coleccion de documentos en Firestore
    firebase.auth().signInAnonymously().catch(function(error) {
        console.log("Codigo de Error: " + error.code);
        console.log("Mensaje de Error: " + error.message);

function getAll() {
    dbRef.get().then((snapshot) => { => {

The problem is that executing this code gives me the following error: Uncaught TypeError: Can not read property 'get' of undefined Mark this error on line 13 when inspecting the code in the browser.

I hope you can help me. From already thank you very much. :)

asked by Joaquin Gonzalez 12.12.2018 в 00:55

0 answers