My KV binding is not being set by my wrangler.toml file when deploying to my production environment
Hello Cloudflare Community!
My KV binding is not being set by my wrangler.toml file when deploying to my production environment.
It works fine on the staging worker, but when I deploy to the production worker the KV binding is wiped, so I have to add it manually using the dashboard after each deploy (which causes downtime).
In my wrangler.toml file, I’m setting kv_namespaces in exactly the same way in [env.production] as I am in [env.staging], and also in the top section of the file (with no environment).
I’ve searched through this community and can’t find any posts on this exact topic.
Below is my full wrangler.toml, and a screenshot of the dashboard with the message recommending updating my wrangler.toml file to keep your local development environment in sync (which I have done).
Thanks very much in advance for your help!
5 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Thank you very much @sapkotamadan ! I'll try that on our next deploy.
Hi @sapkotamadan , thanks for the suggestion but unfortunately after deploying the wrangler.toml code you wrote above, the same issue is still there. On deploy to production, it wiped the KV binding and I had to add it in again, causing downtime. Have you any idea why this might be happening? Thanks!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
Thanks @sapkotamadan , I was aware of that, and was doing exactly that, but the production one was not binding (even though the development one was working).
However, I tried removing the preview and then production worked! So thanks for your help. Cloudflare definitely need to update their docs to make it clear that KV bindings will break if you include a preview in your production settings.