如何跟踪“缺少或权限不足"的来源?在Firestore中? [英] How to track down source of "Missing or insufficient permissions" in Firestore?

查看:49
本文介绍了如何跟踪“缺少或权限不足"的来源?在Firestore中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

注意::该问题与如何解决任何特定的缺少权限或权限不足" Firestore错误有关.这个问题是关于追踪错误的根源.关于S.O.的所有其他问题我已经能够找到在Firestore中引用此错误的问题是一个不同的问题,因此在尝试将其标记为重复项之前,请通读整个问题并检查发现的其他任何问题的创建日期.

NOTE: This question is not about how to resolve any particular "Missing or insufficient permissions" Firestore error. This question is about tracking down the source of the error. Every other question on S.O. that I've been able to find that references this error in Firestore is asking a different question, so please read through the entire question and check creation dates on any other questions you find before you try to mark this as a duplicate.

tl; dr:是否有很好的方法来查找触发此错误的代码中的位置 被侵犯了吗?

tl;dr: Is there a good way to track down either the location in code that triggers this error or the specific security rule that is being violated?

当Firebase库引发此错误时,它不提供有关该错误在代码中的何处引发或违反了哪个安全规则的任何信息(这可能是一件好事,因为在野外提供此信息可能使黑客更容易进行恶意行为).但是,在开发中,这使调试变得很困难.如果我正在处理特定的查询,通常这不是问题,因为当我进行更改并看到此错误时,我知道我正在处理的代码正在引起该错误.但在其他情况下,来源不那么明显.

When the Firebase library throws this error it doesn't provide any information about where in the code this error is being throw or which security rule is being violated (which is probably a good thing, since in the wild, providing this information could make it easier for a hacker to do something nefarious). However, in development, it makes things difficult to debug. If I'm working on a particular query, it's usually not a problem, because when I make a change and see this error, I know the code I was just working on is causing the error. But there are other circumstances where the source is less obvious.

推荐答案

了解如何使用Firebase安全规则模拟器.它将向您显示规则评估过程中发生的情况.除此之外,当前没有诊断可帮助您了解从客户端代码调用时部署到您的项目的安全规则的情况.

Learn how to use the Firebase security rules emulator. It will show you what's happening during rule evaluation. Other than this, there are currently no diagnostics to help you understand what's happening with security rules deployed to your project when invoked from client code.

https://firebase.google.com/docs/firestore /security/test-rules-emulator

这篇关于如何跟踪“缺少或权限不足"的来源?在Firestore中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆