Worker KV Not Binding
I converted a worker from UI to use github/local to push the code. That sync process is working fine to deploy it. The issue is the KV bindings are not holding. If I manually add the KV in the UI then it works, but on next deployment it wipes out the bindings in the UI. My toml:
I noticed when testing locally with wrangler dev it doesnt pickup these bindings either. I have setup my worker to handle multiple routes:
And route:
Everything works fine if I manually add the kv in the UI under worker settings. But I cant get the toml to deploy and actually work. Wipes it out every deployment 😦 Anybody got a clue?
8 Replies

Case ID: 01388357
Just toml tables fun. You can use wrangler json configs, or if you ever get confused, try toml to json converters online. They make it very obvious what the issue is, which is having the obs logs table makes and then kv_namespaces below it, makes it part of obs table:

The lazy fix is to move it above any table, or make it into a table itself like
.. or use json configs
ok this is helpful!
@Chaika So i made that update so it compiles TOML to JSON properly but it still didn't bind any of the namespaces:
Ok made a discovery. So the TOML file still allows a build to go through even if something is wrong/failing and zero log issues. So I started updating the wrangler.jsonc file in addition and finally got some failure logs to discover that I had a wrong KV id number somehow. So whats the point of having a TOML and a jsonc file when they are essentially identical? Should builds only have the jsonc when deploying via github?
Both should have the exact same validation. Toml and jsonc is just different formats for the same config
Thx. Should only one or the other exist in the project?
You should only use one of them yea