I know I saw this in here before but

I know I saw this in here before but cant seem to find any resolution to it... I'm currently getting errors saying my cursor is invalid and not sure how to fix 🤔 My code looks like so:
let cursor: string | undefined, complete = false

do {
const { keys, list_complete, cursor: cur } = await env.Tracking.list<R2LatencyMetadata>({ cursor, prefix: 'TimeSeries/R2' })

complete = list_complete, cursor = cur

// Do some things with keys
} while (!complete && cursor)
let cursor: string | undefined, complete = false

do {
const { keys, list_complete, cursor: cur } = await env.Tracking.list<R2LatencyMetadata>({ cursor, prefix: 'TimeSeries/R2' })

complete = list_complete, cursor = cur

// Do some things with keys
} while (!complete && cursor)
13 Replies
Unsmart
UnsmartOP•3y ago
Seems like I am still getting errors sometimes but a lot less than when I originally posted the above. Just had a request fail saying to following cursor is invalid if it helps (kv 7a23d30e52584ab3bb7e435dc46425b7):
AAAAAKefr5koF_j1ipVn7Cx2QE7w038HvtdrkFVj3ygFk-44CxmMDG0686KqfWaHDkvP4yccMUrkaXVvjGhqCyhVH2LWHgcSGx_nNSPH_pATcazSGbROeE9bA7HkKOxs-cpeygoq3fGvkhH39UumjmkBo5LkNvQ1JrYJArREpIbcZeZlU3wdIHGbQPixi9aRU8vEMagQwMsjLYkCW-XdMJEZm5PH9g9CRA4xkVUBs3I2AC5mbrBFQq6duH12iH0ncwprLWLzvXQypjjK1-0j2uzw_1H9VI9Yff7Mr9i5NGJQ9tESWrvoswMu0rW0Xf9mE5D7-N4YFvW69NcaGJuu1cHQU8rOrJBI
AAAAAKefr5koF_j1ipVn7Cx2QE7w038HvtdrkFVj3ygFk-44CxmMDG0686KqfWaHDkvP4yccMUrkaXVvjGhqCyhVH2LWHgcSGx_nNSPH_pATcazSGbROeE9bA7HkKOxs-cpeygoq3fGvkhH39UumjmkBo5LkNvQ1JrYJArREpIbcZeZlU3wdIHGbQPixi9aRU8vEMagQwMsjLYkCW-XdMJEZm5PH9g9CRA4xkVUBs3I2AC5mbrBFQq6duH12iH0ncwprLWLzvXQypjjK1-0j2uzw_1H9VI9Yff7Mr9i5NGJQ9tESWrvoswMu0rW0Xf9mE5D7-N4YFvW69NcaGJuu1cHQU8rOrJBI
@walshydev sorry for the ping but I assume I am doing nothing wrong and I still get these errors saying my cursor is invalid with the above code. Curious if you would be able to ping the right people for this 🙂 Its like ~5-10% of requests that fail currently
Walshy
Walshy•3y ago
I'd probably ping @kian for this tbh LuL
kian
kian•3y ago
blobcatglare
Unsmart
UnsmartOP•3y ago
If it helps also anytime it fails its always the second page the (the first one that actually has a cursor) at least that I have seen
kian
kian•3y ago
i'd assume cursors are just an opaque string - but if anyone had the tools to see what the error was it's you not me :^)
kian
kian•3y ago
however it appears that I can't test much anyways since KV throws a 429 at me for a namespace with like 5 keys
No description
Unsmart
UnsmartOP•3y ago
Yeah I get 429s every once in a while in waves also dont really track that though. Easier to see the cursor failing since I run it on a cron and it throws an error I can see on my worker summary 🤷 even my list operations are getting 429s now actually normally its only the writes interesting
Walshy
Walshy•3y ago
oh i thought this was R2 not KV I got confused by the type LuL
Unsmart
UnsmartOP•3y ago
Lol yeah this is KV but im using to track r2s latency over time LUL
Walshy
Walshy•3y ago
do you not have AE?
kian
kian•3y ago
expiration on keys can cause oddities with pagination but that only affects you if checking keys - checking list_complete wouldn't be affected
Unsmart
UnsmartOP•3y ago
No I dont have AE yet 😦 I dont expire any keys currently also Now >50% of requests are failing SadgeCry
Unsmart
UnsmartOP•3y ago
I run the cron every minute (so if all failed each line would be at 60 in this graph). Its at 34/ hr at the current peak
No description
Want results from more Discord servers?
Add your server