Error on deploy from Github: unknown operator '%stringToOid'"

Hi!
I have Rules like these which help to compare string value stored in JWT token to the owner field of type ObjectId:

"apply_when": {
  "owner": {
    "%stringToOid": "%%user.data.id"
  }
},

It works perfectly if I edit it from the Realm’s UI.

But if I try to deploy the same configuration automatically from Github I get Failed: failed to import app: failed to migrate permissions: unknown operator '%stringToOid' in the Deploy logs and no changes are deployed.
Do you have an idea what I may be doing wrong?

1 Like

Hi! thanks for reporting - this looks like a bug. I’ve filed it with the engineering team but as a temporary workaround, you can either
a) continue using the UI to deploy your application
b) write a function that converts an objectId to a string and use that within rules (example here)

1 Like

Thank you so much for the response!
I think we’ll use the UI for now knowing that it’d soon be fixed, but it’s good to know there’s a workaround!

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.