env.KV_NAMESPACE.put(...) never actually writes anything
i might be dong this icorrectly, if so, please tell me:
i connected the KV to my worker in the toml file. that also shows up on cloudflare's website. whenever the user sends json data, it should get written:
even though requestData is defined, and groupCal gets written to, it seems like GROUP_CAL isnt getting written to, since when returning the new site (or even retrieving it a couple minutes after the
put
), and writing from
GROUP_CAL
to groupCal
, the result is always {}
:
what am i doing wrong?9 Replies
also, GROUP_CAL should be of type
Map<String, Map<Number, Boolean>>
You need to
await
the KV put
. This one: env.GROUP_CAL.put(requestData.name, m);
It's a promisewhen i do that, nothing updates - could that be because of the cpu runtime restriction?
i dont really know jsut asking
?
also no entries are registered using this, so it just doesnt work (in my case)
Anybody?
i dont get it is this like an answer once thing?
nothing in the logs, is the value supposed to be stringified? never saw it in the docs
nothing ever in the logs actually, even when the worker errors
actually makes sense, will try
value
in a KV.put
call needs to be a string
, ReadableStream
, or ArrayBuffer
. Any other type is likely to be serialised to {}
or something alike.
You will need to both await
the put
calls, and convert to a data type that you can write.
See https://developers.cloudflare.com/workers/runtime-apis/kv/#writing-key-value-pairs for more detailsok thanks will try
writing works, but now i cant reas anything from there 🤔
it looks like nothing can get read, even if i manually input it
both list() return an array with 0 length, and
get()
always returns null, even when values existCan you provide a minimal script to reproduce what you’re seeing?
resolved, cloudflare KV doesnt like hebrew keys
actually, is that an issue? never saw that documented
That should work fine as far as I know 🤔
there is some overall strangeness around RTL letters, since some platforms add dpecial chars (directional chars) to know how to render them, so the case here might be windows\vscode\cludflare adding\removing these chars (and that isnt noticble since they are invisible 0-width chars...)