[英]Firestore errors: Firestore (9.1.0): Could not reach Cloud Firestore backend
[英]Error: Could not reach Cloud Firestore backend after changing from hardcoded data to process.env
我收到此錯誤:
@firebase/firestore:Firestore (9.9.0):無法到達 Cloud Firestore 后端。 連接失敗 1 次。
從更改我的 firebase 配置后
apiKey: "SecretApiKey",
authDomain: "SecretAuthDomain",
[...]
}
到:
const firebaseConfig = {
apiKey: process.env.apiKey,
authDomain: process.env.authDomain,
[...]
}
我也沒有像 2 天前或我用 firebase 制作其他項目時那樣收到此錯誤。
我在互聯網上看到了這個問題,解決方案是改為:
const firestoreDB = initializeFirestore(firebaseApp, {
experimentalForceLongPolling: true, // this line
useFetchStreams: false, // and this line
})
但這對我也不起作用,我得到另一個錯誤。
我在 .env 文件中設置了憑據,它確實顯示為適當的變量。 但是,對我有用的是將憑據放在.js
文件中並從那里使用它們。 另外,請不要忘記在.gitignore
中添加憑據文件
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.