[英]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.