关于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 }
问题解答
仅下载(读取)picture.jpg时,是否产生Firestore读取费用?
不会。读取规则直接设置为allow read: if true,整个校验流程不会触发任何Firestore查询操作,仅会产生Firebase Storage的读取流量费用,无Firestore相关计费。写入操作因request.auth为null失败时,是否产生相关计费?
不会。规则采用短路求值逻辑,当request.auth != null这个前置校验不通过时,后续的firestore.get()调用不会执行,因此不会产生Firestore读取费用;同时由于写入操作未通过权限校验而失败,也不会产生Firebase Storage的写入相关计费。
内容的提问来源于stack exchange,提问作者tonnoz
相关产品推荐
相关产品推荐

