I'm following this twitter clone (using Vue) tutorial, and on about 01:30:00 he connects his app to firebase.
I created firebase DataBase, and copied the firebase parameters.
I entered a dummy document to the Database.
I cloned the GitHub repo for this project, and changed the 'firebase.js' file with the firebase parameters.
This is the firebase.js
:
import firebase from "firebase/app"
import "firebase/firestore"
const firebaseConfig = {
apiKey: "...",
authDomain: "...",
projectId: "...",
storageBucket: "...",
messagingSenderId: "...",
appId: "...",
}
firebase.initializeApp(firebaseConfig)
let db = firebase.firestore()
export default db
And I got the following error (in chrome on 'localhost:8080'):
Uncaught FirebaseError: "projectId" not provided in firebase.initializeApp.
at new n (prebuilt-306f43d8-45d6f0b9.js?fef0:188)
at eval (prebuilt-306f43d8-45d6f0b9.js?fef0:14819)
at n.t (prebuilt-306f43d8-45d6f0b9.js?fef0:14821)
at new n (prebuilt-306f43d8-45d6f0b9.js?fef0:15414)
at eval (index.js?1c42:69)
at Component.eval [as instanceFactory] (index.js?1c42:66)
at Provider.getOrInitializeService (index.esm.js?a40d:338)
at Provider.getImmediate (index.esm.js?a40d:130)
at FirebaseAppImpl._getService (index.esm.js?8d00:219)
at FirebaseAppImpl.firebaseAppImpl.<computed> [as firestore] (index.esm.js?8d00:437)
- I changed the 'firebase.js' with the example that on the Vue website.
firebase.js
:
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
import { initializeApp } from "firebase/app";
const firebaseConfig = {
apiKey: "...",
authDomain: "...",
projectId: "...",
storageBucket: "...",
messagingSenderId: "...",
appId: "...",
measurementId: "..."
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
But I still get the same error (as on section 3).
CodePudding user response:
My guess is that the file firebase.js
may not being loaded. You can check it with a
console.log('test')
inside that file.
If it is not loading I would try changing the name form firebase.js
to fb.js
.
CodePudding user response:
The problem is that the database wasn't named correctly (as demanded in the open source) - I needed to call it Qwitter.