You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

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

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.02 03:03:11