How to Store JS in KV Worker


has anyone the idea how I can store a JSON response in KV?

I tried both, to save the Response, and the JSON Object, both tells me that it must be a String or Arraybuffer etc…

    const response = await fetch(url+'?uid='+userId)
    userData = await response.json()
    //write with TTL
    PXKVNS.put(userKv, response , {expirationTtl: 60 })

I got the error:

KV put() accepts only strings, ArrayBuffers, ArrayBufferViews, and ReadableStream

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.