CloudKit error - CKErrorRequestRateLimited

First query works fine. If next query comes within 30 seconds of first query it generates a CKErrorRequestRateLimited (error.code==7) error telling me to try after a time such that there would be 30 seconds between queries.

<CKError 0x30299dd70: "Request Rate Limited" (7/2061); "Operation throttled by previous server http 503 reply. Retry after 20.5 seconds. (Other operations may be allowed.)"; Retry after 20.5 seconds>

Answered by DTS Engineer in 819122022

It's as-designed that the system throttles an app's CloudKit request when it determines that the request rate is too high. How to identify and handle CloudKit throttles is discussed in the following technote:

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

Actually the error occurs all the time. All queries are rejected. I am able to fetchRecordWithID: and saveRecord: but when I try a performQuery: it fails the first time with CKErrorServerRejectedRequest. Here is the error.userInfo:

{ CKDHTTPHeaders = { "Content-Encoding" = gzip; "Content-Type" = "application/json; charset=UTF-8"; Date = "Tue, 17 Dec 2024 17:37:34 GMT"; Server = "AppleHttpServer/d2dcc6a0a5e3"; "Strict-Transport-Security" = "max-age=31536000; includeSubDomains;"; Via = "xrail:mr42p00ic-qujn09141101.me.com:8301:24R623:grp20,631194250daa17e24277dea86cf30319:c26f48d6a50e4cd190c61a0c95718444:usuyk1"; "access-control-expose-headers" = "X-Apple-Request-UUID,Via"; "retry-after" = 30; "x-apple-edge-response-time" = 749; "x-apple-request-uuid" = "C4501E94-1390-4A2D-97BE-765D2EEC6679"; "x-apple-user-partition" = 24; "x-responding-instance" = "ckdatabaseservice:714813850:prod-p24-ckdatabaseservice-50percent-58f78f985d-w8nqc:8080:2429B399:feb23af4ba8edac43c48e1a1025eba9548907ffd"; }; CKHTTPStatus = 503; CKRetryAfter = 30; ContainerID = "iCloud. [ my CloudKit container here ] "; NSDebugDescription = "CKInternalErrorDomain: 2000"; NSUnderlyingError = "Error Domain=CKInternalErrorDomain Code=2000 "(null)" UserInfo={ContainerID=iCloud. [ my container here ] , CKRetryAfter=30, CKHTTPStatus=503, CKDHTTPHeaders={\n "Content-Encoding" = gzip;\n "Content-Type" = "application/json; charset=UTF-8";\n Date = "Tue, 17 Dec 2024 17:37:34 GMT";\n Server = "AppleHttpServer/d2dcc6a0a5e3";\n "Strict-Transport-Security" = "max-age=31536000; includeSubDomains;";\n Via = "xrail:mr42p00ic-qujn09141101.me.com:8301:24R623:grp20,631194250daa17e24277dea86cf30319:c26f48d6a50e4cd190c61a0c95718444:usuyk1";\n "access-control-expose-headers" = "X-Apple-Request-UUID,Via";\n "retry-after" = 30;\n "x-apple-edge-response-time" = 749;\n "x-apple-request-uuid" = "C4501E94-1390-4A2D-97BE-765D2EEC6679";\n "x-apple-user-partition" = 24;\n "x-responding-instance" = "ckdatabaseservice:714813850:prod-p24-ckdatabaseservice-50percent-58f78f985d-w8nqc:8080:2429B399:feb23af4ba8edac43c48e1a1025eba9548907ffd";\n}, RequestUUID=C4501E94-1390-4A2D-97BE-765D2EEC6679, OperationID=3D4D8CAA1CAA2325}"; OperationID = 3D4D8CAA1CAA2325; RequestUUID = "C4501E94-1390-4A2D-97BE-765D2EEC6679"; }

It's as-designed that the system throttles an app's CloudKit request when it determines that the request rate is too high. How to identify and handle CloudKit throttles is discussed in the following technote:

Best,
——
Ziqiao Chen
 Worldwide Developer Relations.

CloudKit error - CKErrorRequestRateLimited
 
 
Q