Cursor pagination truncates Cognigy log streams during high-volume GET requests

Running GET /api/v2/logs/messages with sessionId and timestamp boundaries hits a 429. The cursor stops advancing, so fetchLogStream() loops the same offset block. Switching to Accept: application/x-ndjson helps, but parseJsonStream() drops eventType payloads.

{ "code": 429, "message": "Rate limit exceeded", "cursor": "eyJvZmZzZXQiOjE5OH0=" }

storageQuota shows 78%. It’s throttling GET calls. Stream dies at offset: 198.

Cause: The 429 error blocks the cursor since the client ignores the Retry-After header during high volume. Solution: Inject an OTel span to trace the request and add a backoff loop. Don’t loop the same offset.

curl -H "Authorization: Bearer $TOKEN" -H "x-paging-cursor: $NEXT_CURSOR" "https://api.mypurecloud.com/api/v2/logs/messages"

Check the trace logs.