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?
3 Replies
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
Ah that makes much more sense - I appreciate the help!
how to test local resources?