Home > Back-end >  I cant import firebase
I cant import firebase

Time:12-07

Hi I am trying in src>index.js `

import {initializeApp} from 'firebase/app'

`

I am learning from a video. When the man in the video wrote this code, he wrote that it is being calculated next to him in green, but it does not write to me. and I think that's why when I try to pull data from firebase database I get the following error in the console

index.html:1 Uncaught (in promise) FirebaseError: Missing or insufficient permissions.

Can anyone know the solution?

CodePudding user response:

There is all my index.js code;

import {initializeApp} from 'firebase/app'

import {getFirestore,collection,getDocs} from 'firebase/firestore'

const firebaseConfig = { apiKey: "AIzaSyBQLcH-X3CaBl_q1DDTRKT8YwTKXZWDf90", authDomain: "fir-v9-48d99.firebaseapp.com", projectId: "fir-v9-48d99", storageBucket: "fir-v9-48d99.appspot.com", messagingSenderId: "56672194221", appId: "1:56672194221:web:b998bf8249be351ee2c024" };

initializeApp(firebaseConfig);

const db=getFirestore();

const colRef=collection(db,'notlar');

getDocs(colRef) .then(snapshot=>{

    console.log(snapshot.docs);
})

CodePudding user response:

Your firebase firestore rules don't allow reads or write for the collection that you are trying to query from.

Goto Firebase console and modify the firestore rules Docs: https://firebase.google.com/docs/firestore/security/get-started

  • Related