© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•3y ago•
6 replies
boggin

KV access in a Sveltekit dev environment

Hi there. Appreciate the help in advance. I'm having the worst time trying to figure out if its possible to use a KV store in a dev environment. I'd like to use a full-on test KV where I can save keys and such.
It seems everything that I've tried,
platform.env
platform.env
on a server endpoint on my Sveltekit app is only available deployed in production. I'm using
npx wrangler pages dev .svelte-kit/cloudflare
npx wrangler pages dev .svelte-kit/cloudflare
once built, with
toml 
kv_namespaces = [
  { binding = "test", id = "76n8s756fi7sd56fn", preview_id = "7sdtn6fi6s5dbf76s5ndf" },
]
toml 
kv_namespaces = [
  { binding = "test", id = "76n8s756fi7sd56fn", preview_id = "7sdtn6fi6s5dbf76s5ndf" },
]
in my wrangler.toml. (random hash ids for example's sake)
console logging
platform.env
platform.env
is always
undefined
undefined
though the wrangler pages dev.

I've done
wrangler kv:namespace create test
wrangler kv:namespace create test
and used preview_id just as the docs say, but I just can never access
platform
platform


Is it possible to have full KV functionality in a local dev environment? And if so, I don't understand how
platform
platform
connects using Sveltekit.
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Can't access KV namespace in local dev [VITE]
Cloudflare DevelopersCDCloudflare Developers / pages-help
3y ago
Can't access environment variables in Wrangler dev
Cloudflare DevelopersCDCloudflare Developers / pages-help
3y ago
Access bindings in dev
Cloudflare DevelopersCDCloudflare Developers / pages-help
3y ago
Pages, Sveltekit and Environment variables
Cloudflare DevelopersCDCloudflare Developers / pages-help
2y ago