访问用户数据时,Firestore GET请求导致“空值错误”?

时间:2019-09-06 16:35:31

标签: google-cloud-firestore firebase-security

我在Firestore中有一个用户集合。我为每个注册用户创建一个条目。

集合如下:

{
  email: 'test@test.com',
  username: 'test',
  uid: 'ggsdgdsgfdgrsgfd' /* user id I get from auth object */
}

我的Firestore规则如下:-

    match /users/{user} {
      // Allow the user to get user info 
      allow get: if signedIn() && request.auth.uid == resource.data.uid;

      // Allow no one to get a list of posts
      allow list: if false;
    }

当我尝试在我的应用程序和在线模拟器中获取用户文档时,出现以下错误。

Error running simulation – Error: simulator.rules line [16], column [55]. Null value error.

我正在使用适当的帐户请求用户对象。

0 个答案:

没有答案