首页 > 解决方案 > 如何修复 React+Cloud Firestore 中的“未处理的拒绝(错误):不支持”错误

问题描述

我正在尝试使用以下查询查询 Cloud Firestore 数据库:

db.collection("shops").where("email", "==", user.email).get()
.then(...)
.catch(...)

我在“catch”块中编写了代码以处理承诺拒绝,但通过调用“.get()”出现以下错误

Unhandled Rejection (Error): not supported

我在网上查了这个错误,似乎没有人问这种错误。有人知道是什么原因造成的吗?我已经根据官方文档完成了我所有的 firebase/firestore 查询。谢谢!

标签: reactjsfirebasegoogle-cloud-firestore

解决方案


您使用的是哪个 Firebase SDK?我在使用 Firebase-Admin 的 Node 应用程序上遇到了同样的错误,但是因为我使用 domino 创建一个 Window 对象,所以它会失败,因为它通过检查 global.window 来检查它是否在 Node 上运行。


推荐阅读