difficulties in firebase realtime database setup

998 views
Skip to first unread message

Yael Talmor

unread,
Jul 1, 2019, 5:09:25 PM7/1/19
to Firebase Google Group
hi you all,
I'm trying to start up a simple javascript web project using the firebase database,
and I made all the requirements steps according to this https://firebase.google.com/docs/web/setup?authuser=0 tutorial,
and added to my html file this to the header:
___________________________________________________________________________
    <head>
        <link rel="stylesheet" href="style.css" type="text/css">
        <script defer src="https://www.gstatic.com/firebasejs/6.2.4/firebase-app.js"></script>
        <script defer src="https://www.gstatic.com/firebasejs/6.2.4/firebase-database.js"></script>
    </head>
___________________________________________________________________________
and to my js file:
___________________________________________________________________________
var firebaseConfig = {
    apiKey: "AIzaSyDxIc5z4g3xUu01Du5_rKm5eKPUSQIfoZg",
    projectId: "eko-home-assignment-6e3a2",
    storageBucket: "",
    messagingSenderId: "189458946837",
    appId: "1:189458946837:web:95614c48d4ae8871"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
// Get a reference to the database service
var database = firebase.database();
___________________________________________________________________________
and when I run the app on my http-server localhost on chrome I get: 
player.js:24 Uncaught ReferenceError: firebase is not defined
    at player.js:24

what am I doing wrong? 
just so you know I managed to do the "firebase init" command and didn't manage to do "firebase deploy" and also didn't do hosting during the installation steps. 

thanks a lot,
Yael



Kato Richardson

unread,
Jul 1, 2019, 5:50:48 PM7/1/19
to Firebase Google Group
Hi Yael,

Is your JS script also deferred? If not, then you may need to remove the defer in your script tags. My guess here is that Firebase hasn't downloaded and initialized at the point that you try to access.

☼, Kato

--
You received this message because you are subscribed to the Google Groups "Firebase Google Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to firebase-tal...@googlegroups.com.
To post to this group, send email to fireba...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/firebase-talk/cf463fea-89f7-4083-9ace-0da270bbb192%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Kato Richardson | Developer Programs Eng | kato...@google.com | 775-235-8398

Reply all
Reply to author
Forward
0 new messages