【发布时间】:2021-11-23 03:40:07
【问题描述】:
我正在关注 this twitter clone (using Vue) 教程,并且在大约 01:30:00 时,他将他的应用程序连接到了 Firebase。
-
我创建了 firebase 数据库,并复制了 firebase 参数。
-
我在数据库中输入了一个虚拟文档。
-
我克隆了 the GitHub repo for this project,并使用 firebase 参数更改了“firebase.js”文件。
这是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
我收到以下错误(在 'localhost:8080' 上的 chrome 中):
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)
- 我用 Vue 网站上的示例更改了“firebase.js”。
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);
但我仍然遇到相同的错误(如第 3 节所述)。
【问题讨论】:
标签: javascript firebase vue.js firebase-realtime-database