KV giving null while doing get even though the key exists
There is no error from KV and also there is no response with correct value.
then part of the response, not the catch part. So the request is successful while the return response from kv is null even though there is value for the said keyget of an empty key isn't wrong, then no error is thrown.Are you testing locally or are you working in production?
catch handler.cacheTtl you set, if any.KV_NAME bound to the correct KV namespace?let res = await env.KV_NAME.get(kv_id)
.then((r) => {
console.log("Successful response from KV => ", r);
return r;
})
.catch((e) => {
console.warn(" error in getting the from kv ", e);
return null;
});thencatchcatchcacheTtllet res = await env.KV_NAME.get(kv_id);
console.log(`res = ${res}`)KV_NAME