Real data in local mode
Hey everyone! We've recently been thinking about using real production KV/R2 data in local mode with
wrangler dev --local
and Miniflare. This suggestion was raised a while ago by @Erwin (https://github.com/cloudflare/miniflare/issues/24), but it would be great to get feedback from you all on this idea.
How do you think this should work? Would you prefer if we always fetched/wrote from/to your actual KV namespaces/R2 buckets to give you the most up-to-date values? Or would you prefer the lower-latency of fetching values once then caching them locally?
Would you be ok if we just fetched all of your data in one go, and then you just developed as if it were local, or have you got too many keys/objects for that?
Is this a feature you'd like to use, or do you not mind creating fake data locally?GitHub
Issues · cloudflare/miniflare
🔥 Fully-local simulator for Cloudflare Workers. Contribute to cloudflare/miniflare development by creating an account on GitHub.
6 Replies
🧵
Would be cool if the caching behavior mimicked the real deployments. So, KV is pulled when requested, and cached locally as normal
oh damn, personal opinion. I always want local to use local data. I wish persistence was enabled by default in Wrangler though
However, this is a common misunderstanding so it would be nice to have as an option.
Yeah, this feature definitely wouldn't be on by default. 👍
Ok yeah maybe for debugging purposes an option would be neat but yeah always local by default 🙂
I think there are a few different use-cases for KV. There is of course the straight data one, where you will want to switch between local and remote.
But it is also used for configuration, which you just might want to always use one of the remote ones.
But I would just start with with an optional flag per namespace for either local, preview or prod. And take it from there.
Don’t do anything too fancy, just pull data down on demand. Ideally cache it for the TTL.
Very much agree with this.. (unsurprisingly)