Firestore兼容MongoDB模式下API访问禁用,如何开启?
问题:在哪里开启Firestore API数据访问权限?
代码示例(Node.js Firestore SDK)
initializeApp(); const db = getFirestore("db-name"); ..... const ref = db.doc(`${firestoreCollectionUsers}/${data.auth.uid}`); const doc = await ref.get();
运行报错
Error: 9 FAILED_PRECONDITION: Firestore API data access is disabled. Please enable it if you want to access the database through Firestore API.
注:该代码在Firestore原生模式下可正常运行。
开启步骤
- 进入Google Cloud控制台,选择对应项目
- 在左侧菜单栏找到「API和服务」→「库」
- 在搜索栏输入「Cloud Firestore API」,定位到该API
- 点击「启用」按钮,等待系统完成启用操作即可
内容的提问来源于stack exchange,提问作者bel
相关产品推荐
相关产品推荐

