Firestore Rules Simulator-子集合的请求为空

时间:2019-06-03 18:37:27

标签: google-cloud-firestore firebase-security-rules firebase-tools

以下规则在嵌套(**)匹配中的“请求”上产生错误:

运行模拟时出错-错误:simulator.rules第[10]行,第[30]列。空值错误。

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {

    // Allow users to only edit their records
    match /users/{userId}{
      allow read, update, delete: if request.auth.uid == userId;
      allow create: if request.auth.uid != null;   
      match /{documents=**} {
        allow read, write: if request.auth.uid == userId;
      }
    }    

  }
}

失败的模拟器测试是:

GET: /users/MyUserId/items/MyItemId

这使用的是“密码”身份验证,但是即使以“未经身份验证”身份运行也会产生相同的错误,就像模拟器未正确编译规则一样。

1 个答案:

答案 0 :(得分:0)

进一步的故障排除表明它可以在数据库中实时运行,而不能在模拟器中运行。因此必须是模拟器错误。

相关问题