Can someone explain how to properly connect to Firebase DB?

I have been trying to connect my wix website to my firebase DB. I’ve been looking all over the place trying to figure out how to get it to work. I found similar threads but have been unable to repeat their success. [ https://www.wix.com/corvid/forum/community-discussion/firebase-package-gave-error-firebase-firestore-is-not-a-function ] I have all sorts of package import errors.

In my current application (not on Wix) all I have in my JS file is

import firebase from 'firebase';
const firebaseConfig = {
...
};
firebase.initializeApp(firebaseConfig);
let firebaseConnection = firebase.firestore();

and then I am able to get the data that I need by doing

const docRef = firebaseConnection.collection('Data').doc('TestDoc');
return dispatch => {
    docRef.get()
    .then(response =>{
        if (response.exists) {
            console.log("Document Exists");
            console.log(response.data().DATA);
        }
        
        else{
            console.log("No such document!");
        }
})
}

I am struggling to be able to get the connection for firebase however and getting import issues and package errors. Is there anyone out there with a succinct tutorial on how to connect their wix site to firebase?

1 Like

Hey, Brian.

Please take a look at this post that might help you start. If the issue persists, please provide us with the following information so we can take a look at the issue:

  1. Link to your site;

  2. steps to recreate the issue;

  3. screenshots of the error messages you are getting.

Thank you, we await for your reply.