Unable to get KV values from namespace while running wrangler dev

I created a kv namespace with the wrangler cli and put the id and binding in my wrangler.toml. Now when I call env.<BINDING>.get(<KEY>) I always get a null response. Though, when I try to get that same key from the same kv namespace using the Wrangler CLI I get the correct value. Has anyone run into this same issue?
No description
No description
3 Replies
Chaika
Chaika14mo ago
wrangler 3.x by default uses local mode which has its own local resources for testing. If you want to use the live/remote version of your resources, you can use --remote, like wrangler dev --remote If you wanted the wrangler kv commands to interact with local data rather then remote/live data, you can use the --local flag with them ex: wrangler kv:key get test --binding=live_test --local
Jack Walker
Jack WalkerOP14mo ago
Ah that makes much more sense - I appreciate the help!
cc5926
cc592613mo ago
how to test local resources?

Did you find this page helpful?