Skip to content

[Firestore] Security rules return permission denied when reading immediately after writing new document #185

Closed
@SUPERCILEX

Description

@SUPERCILEX

[REQUIRED] Step 2: Describe your environment

  • Firebase Component: Firestore
  • Component version: 17.1.5

[REQUIRED] Step 3: Describe the problem

Suppose I'm writing this document:

field1: true
...
owners:
  uid1: 5

With these security rules:

match /teams/{teamId} {
    allow get: if resource.data.owners[request.auth.uid] is int;
    allow write: true;
}

And this code:

ref.set(obj)
ref.get() // This fails!

The get request will fail with a PERMISSION_DENIED error. But it works fine if I wait a few seconds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions