Firebase Firestore 未在 google chrome 中获取数据
Posted
技术标签:
【中文标题】Firebase Firestore 未在 google chrome 中获取数据【英文标题】:Firebase firestore not fetching data in google chrome 【发布时间】:2019-05-09 21:09:21 【问题描述】:当我从 Firestore 获取数据时,它会在控制台中显示此错误
下面我粘贴了我的代码 在此,我从 Firestore 接收数据并安慰它以检查天气它是否接收到数据,但它显示我在下面提到的错误 相同的代码在 Microsoft Edge 中完美运行
chrome 控制台中的错误
@firebase/firestore:Firestore (5.7.0):无法访问云端 Firestore 后端。后端在 10 秒内没有响应。这 通常表明您的设备没有健康的互联网 此刻的连接。客户端将在离线模式下运行 直到它能够成功连接到后端。
<script src="https://www.gstatic.com/firebasejs/5.7.0/firebase.js"></script>
<script src="https://www.gstatic.com/firebasejs/5.5.5/firebase-firestore.js"></script>
<script>
var config =
apiKey: "AIzaSyAezlP1Y9ofnuiUK50R0t89mLtOR45M4gE",
authDomain: "vuefirestorelearningapp.firebaseapp.com",
databaseURL: "https://vuefirestorelearningapp.firebaseio.com",
projectId: "vuefirestorelearningapp",
storageBucket: "vuefirestorelearningapp.appspot.com",
messagingSenderId: "343583592836"
;
firebase.initializeApp(config);
var db = firebase.firestore();
db.settings(
timestampsInSnapshots: true
);
db.collection('employees').get().then( function(querySnapshot)
querySnapshot.forEach(function(doc)
console.log(doc.data())
)
)
</script>
【问题讨论】:
【参考方案1】:db.collection('/employees').snapshotChanges().subscribe((users =>
for (const user of users)
console.log(user.payload.doc.data())
));
请使用隐身模式
【讨论】:
以上是关于Firebase Firestore 未在 google chrome 中获取数据的主要内容,如果未能解决你的问题,请参考以下文章
视图模型中的 Firestore 方法未在 SwiftUI onAppear 方法中调用
如何使用 ReactJs 对 Cloud Firestore 数据进行分页
Firebase云Firebase。如何在本地模式下在项目间移动数据