How do I list contents of local KV?

I'm running wrangler dev. I get this on startup:

Your worker has access to the following bindings:
- KV Namespaces:
  - KV: 592fd8e6d8a94899b50f6b7e7aba4036 (local)


How can I list all the contents of this KV?

If I try in a new terminal tab:
pnpm wrangler kv:key list --local --binding=KV

it returns
[]
.

So does it when I try:

pnpm wrangler kv:key list --binding=KV --preview


The items are present, from inside the worker I can console.log them. Only from terminal/wrangler I cannot access them.

 list = await env.KV.list()
    for (const key of list.keys) {
      const value = await env.KV.get(key.name)
      console.log(`Key: ${key.name}, Value:`, value)
    }


What am I doing wrong?
Was this page helpful?