Wrangler "No KV Namespaces configured!"

I’m new to Cloudflare/Wrangler, but it seems like the documentation is missing something as
following the directions don’t seem to work.

Starting from here:

  1. I run the first command as
    wrangler kv:namespace create apikeys
🌀 Creating namespace with title "emailvalidator-apikeys"
✨ Success!
Add the following to your configuration file in your kv_namespaces array:
{ binding = "apikeys", id ="4818.........aa2c" }
  1. I have a wrangler.toml file, and I add it to the kv_namespaces array:
kv_namespaces = [
  { binding = "apikeys", id = "4818.........aa2c" }
]
  1. I attempt to add a key/value entry with Wrangler:
    wrangler kv:key put --binding=apikeys "MYKEY" "MYKEYVALUE"
✘ [ERROR] No KV Namespaces configured! Either use --namespace-id to upload directly or add a KV namespace to your wrangler config file.

What am I missing? I already validated in the Cloudflare platform that the namespace does exist, named as expected from the documentation as emailvalidator-apikeys.

Issue resolved. TOML has table inheritance which can cause issues where your kv_namespaces key isn’t actually top-level or under an environment.
I’m not including an environment in my TOML file, so the kv_namespaces became part of d1_databases

name = “useraccounts”

main = “src/index.ts”

compatibility_date = “2023-02-11”

[[ d1_databases ]]

binding = “DB”

database_name = “user_accounts”

database_id = “05eb…6f56”

[[kv_namespaces]]

binding = “apikeys”

id = “4818…aa2c”