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

关于Firebase Storage规则关联Firestore的计费问题咨询

Firebase Storage规则计费问题解答

配置的Storage规则

match /mycoll/{pagenum}/picture.jpg {
    allow read: if true;
    allow write: if request.auth != null
       && firestore.get(/databases/(default)/documents/mycoll/$(pagenum)).data.owner == request.auth.uid; // CHECK OWNER
    allow delete: if false; // DISALLOW DELETE OPERATION
}

问题解答

  1. 仅下载(读取)picture.jpg时,是否产生Firestore读取费用?
    不会。读取规则直接设置为allow read: if true,整个校验流程不会触发任何Firestore查询操作,仅会产生Firebase Storage的读取流量费用,无Firestore相关计费。

  2. 写入操作因request.auth为null失败时,是否产生相关计费?
    不会。规则采用短路求值逻辑,当request.auth != null这个前置校验不通过时,后续的firestore.get()调用不会执行,因此不会产生Firestore读取费用;同时由于写入操作未通过权限校验而失败,也不会产生Firebase Storage的写入相关计费。

内容的提问来源于stack exchange,提问作者tonnoz

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.18 23:20:56