Missing insert permission

Hello, when trying to add a document to a collection over a realm function (Application Authentication) I get following error:

role “owner” in “myApp.Query” does not have insert permission: cannot use ‘user1Id’ in expression; only %% like expansions and top-level operators may be used as top-level fields

My rule looks like this (I insert something into this collection with either user1Id or user2Id being set):

"Query": [
        "name": "owner",
        "applyWhen": {},
        "read": false,
        "write": {
          "$or": [
              "user1Id": "%%user.id"
              "user2Id": "%%user.id"

@ Thomas_Anderl did you end up finding a solution to your problem? I am facing a similar issue when using $or.

I unfortunately did not, I changed the function to run with system priviliges as this functon does not work with sensitive data.