i included these cdn in my html:
<script src=".6.1/firebase-app.js"></script>
<script src=".1.0/firebase-auth.js"></script>
<script src=".1.0/firebase-database.js"></script>
<script src="StoreFeatured.js" type="text/javascript"></script>
and here is the store featured code
var firebaseConfig = {
apiKey: "$$$$$$$",
authDomain: "$$$$$$",
databaseURL: "",
projectId: "thegreatpcstore",
storageBucket: "thegreatpcstore.appspot",
messagingSenderId: "302435893791",
appId: "$$$$$$$",
measurementId: "G-0GH3F41E5S"
};
firebase.initializeApp(firebaseConfig);
new function GetData()
{
firebase.database().ref('/Products/Motherboard/1').once('value').then(function (snapshot) {
//var Description = snapshot.val().Description;
var Name = snapshot.val().Name;
var Price = snapshot.val().Price;
var ImageStr = snapshot.val().ImageStr;
document.getElementById("Mi"+i).src=ImageStr;
document.getElementById("Mn"+i).innerHTML=Name;
document.getElementById("Mp"+i).innerHTML=Price;
}
)
}
what am i doing wrong?
im getting these errors:
> firebase-auth.js:206 Uncaught Error: Cannot find the firebase namespace; be sure to include firebase-app.js before this library.
at firebase-auth.js:206
at firebase-auth.js:206
at firebase-auth.js:206
>
> firebase-database.js:38 Uncaught Error: FIREBASE FATAL ERROR: Failed
> to register the Firebase Database Service (TypeError:
> firebase.INTERNAL.registerService is not a function)
> at dd (firebase-database.js:38)
> at firebase-database.js:245
> at firebase-database.js:245
>
> StoreFeatured.js:17 Uncaught TypeError: firebase.database is not a
> function
> at new GetData (StoreFeatured.js:17)
> at StoreFeatured.js:13
first line of getdata() is doing problem i think im doing something wrong with cdn... please help
if i remove the cdn it gives one error:
StoreFeatured.js:16 Uncaught TypeError: firebase.database is not a function
at new GetData (StoreFeatured.js:16)
at StoreFeatured.js:13
i included these cdn in my html:
<script src="https://www.gstatic./firebasejs/7.6.1/firebase-app.js"></script>
<script src="https://www.gstatic./firebasejs/3.1.0/firebase-auth.js"></script>
<script src="https://www.gstatic./firebasejs/3.1.0/firebase-database.js"></script>
<script src="StoreFeatured.js" type="text/javascript"></script>
and here is the store featured code
var firebaseConfig = {
apiKey: "$$$$$$$",
authDomain: "$$$$$$",
databaseURL: "https://thegreatpcstore.firebaseio.",
projectId: "thegreatpcstore",
storageBucket: "thegreatpcstore.appspot.",
messagingSenderId: "302435893791",
appId: "$$$$$$$",
measurementId: "G-0GH3F41E5S"
};
firebase.initializeApp(firebaseConfig);
new function GetData()
{
firebase.database().ref('/Products/Motherboard/1').once('value').then(function (snapshot) {
//var Description = snapshot.val().Description;
var Name = snapshot.val().Name;
var Price = snapshot.val().Price;
var ImageStr = snapshot.val().ImageStr;
document.getElementById("Mi"+i).src=ImageStr;
document.getElementById("Mn"+i).innerHTML=Name;
document.getElementById("Mp"+i).innerHTML=Price;
}
)
}
what am i doing wrong?
im getting these errors:
> firebase-auth.js:206 Uncaught Error: Cannot find the firebase namespace; be sure to include firebase-app.js before this library.
at firebase-auth.js:206
at firebase-auth.js:206
at firebase-auth.js:206
>
> firebase-database.js:38 Uncaught Error: FIREBASE FATAL ERROR: Failed
> to register the Firebase Database Service (TypeError:
> firebase.INTERNAL.registerService is not a function)
> at dd (firebase-database.js:38)
> at firebase-database.js:245
> at firebase-database.js:245
>
> StoreFeatured.js:17 Uncaught TypeError: firebase.database is not a
> function
> at new GetData (StoreFeatured.js:17)
> at StoreFeatured.js:13
first line of getdata() is doing problem i think im doing something wrong with cdn... please help
if i remove the cdn it gives one error:
StoreFeatured.js:16 Uncaught TypeError: firebase.database is not a function
at new GetData (StoreFeatured.js:16)
at StoreFeatured.js:13
Share
Improve this question
asked Dec 29, 2019 at 21:11
Hassaan RazaHassaan Raza
1974 silver badges14 bronze badges
2
-
2
Shouldn't you be using the same version in all firebase dependencies ? I see
7.6.1
and3.1.0
. – David Magalhães Commented Dec 29, 2019 at 21:39 - i copied it from an answer did not looked at it :( – Hassaan Raza Commented Dec 29, 2019 at 21:40
2 Answers
Reset to default 7Update both the firebase-auth and firebase-database to the following version:
<script src="https://www.gstatic./firebasejs/7.6.1/firebase-auth.js"></script>
<script src="https://www.gstatic./firebasejs/7.6.1/firebase-database.js"></script>
Instead of using various CDN use a single CDN which include all the library:
script src="https://www.gstatic./firebasejs/7.14.4/firebase.js"