Workers KV get throws TypeError: Cannot read properties of undefined (reading 'get')
My wrangler.toml file looks like this:
In my index.ts file I have:
This code results in the error:
I have verified that my namespace with the given ID exists and is named like .
Why isn't my worker able to access my KV?
3 Replies
If it's relevant I am using
You probably have kv_namespaces under a TOML table so it’s not actually binding any namespaces
hmm, i am not sure what you mean. This is what my entire wrangler.toml file looks like:
Ah, thanks for the hint! I changed the binding to:
[[kv_namespaces]]
binding = "BH_API_KEYS"
id = "xxx"
and everything is working as expected