Skip to content

🚀 Feature Request: Examples of using KV with local dev #3332

Closed
@paddymul

Description

@paddymul

Describe the solution

I am trying to develop a workers app. I wish there were examples of using the kv commands in a tutorial

My project.toml looks like this

kv_namespaces = [
    { binding = "FLATBUSH3",id = "24de8aba6ca3470e98741e5d2ecb59d7", preview_id = "6dd38aed6466411ba3cbaad37930ac35" }
]

I am trying to load a JSON file into the kv cache. I have tried the following commands:

wrangler kv:bulk put  --namespace-id 6dd38aed6466411ba3cbaad37930ac35  --preview  ../kv_bulk.json  
wrangler kv:bulk put --binding FLATBUSH3 --preview  ../kv_bulk.json      

I can see the keys via wrangler kv:key get and wrangler kv:key list. My code doesn't see the keys that I have added.

Further, it is possible to store to the KV in JS/TS code as json or an arraybuffer. There is no documented way to do this via the wrangler kv tools. https://developers.cloudflare.com/workers/runtime-apis/kv/#types

I would expect worked examples showing each one of these use cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions