Failed to create public DB CloudKit subscription in production

I'm attempting to save a CKQuerySubscription in production, in the public database, but I'm seeing the following error:

Failed to create CloudKit subscription for Encounter: <CKError 0x3038f66a0: "Invalid Arguments" (12/2006); server message = "attempting to create a subscription in a production container"; op = 093C69242BCC1B0A; uuid = D6E49665-6B8A-4F16-BBD8-B188A4E71F70; container ID = "iCloud.com...">

This is the query’s predicate: NSPredicate(format: "users CONTAINS %@", user.recordID), and the same subscription works perfectly fine in the development CloudKit environment. I have a queryable index on the users field in both environments. Also, I have saved a TRUEPREDICATE CKQuerySubscription in production, and that works perfectly. Does anyone know what I could be missing here?

Answered by outcoldman in 789862022

Recently had the same issue. [1]

It is very counterintuitive, but try to deploy the schema changes from Development to Production in CloudKit. It will show there are 0 changes, but still Deploy.

It seems like the subscriptions do actually have some kind of schemas, that is not present in the Web UI.

  1. https://twitter.com/outcoldman/status/1785403469689413965
Accepted Answer

Recently had the same issue. [1]

It is very counterintuitive, but try to deploy the schema changes from Development to Production in CloudKit. It will show there are 0 changes, but still Deploy.

It seems like the subscriptions do actually have some kind of schemas, that is not present in the Web UI.

  1. https://twitter.com/outcoldman/status/1785403469689413965
Failed to create public DB CloudKit subscription in production
 
 
Q