Wrangler: `wrangler deploy` un-does KV namespace bindings

Created on 15 May 2019  路  7Comments  路  Source: cloudflare/wrangler

In three screenshots:

image

image

image

bug priority - nice to have subject - kv

All 7 comments

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.

For those who find this. The current process to workaround that seems to be working for me now is:

  • Deploy script with wrangler publish (destroys any currently configured bindings)
  • Load CF Worker Editor Web UI to edit your worker.
  • Click the resources tab for the worker and RE-ADD the binding between variable and namespace.
  • Click the code tab AGAIN and 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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

PierBover picture PierBover  路  5Comments

RaniSputnik picture RaniSputnik  路  5Comments

EverlastingBugstopper picture EverlastingBugstopper  路  6Comments

ispivey picture ispivey  路  4Comments

TownLake picture TownLake  路  3Comments