In three screenshots:



Ideally we would use JavaScript Module syntax to detect what KV things needs to be declared:
import posts from "cloudflare:kv/posts".
Alternatively, we could fetch the current bindings, merge it with the local version and publish.
It looks like an update was merged but it doesn't seem to honor the addition of kv_namespaces = ["NAMESPACE"] in the wrangler.toml file. Am I missing something?
The change will create a kv-namespace when it doesnt already exists during the publishing. However, the bug here is that they are not defined in the Worker bindings.
There is currently no support to add Worker KV bindings to the wrangler.toml file to have those bindings generated when the metadata.json is built as part of the wrangler publish command? It is really painful to try and dev using worker KV with wranger when these bindings are removed upon every publish.
We are aware, see https://github.com/cloudflare/wrangler/issues/215
For those who find this. The current process to workaround that seems to be working for me now is:
wrangler publish (destroys any currently configured bindings)DEPLOY the script you previously published with wrangler AGAIN by clicking the button.Next time you do wrangler publish or wrangler publish --release you'll need to do this again.
Hopefully this gets cleanly resolved soon. /smh
closed by #334 . Being released as part of 1.1.0.