Can't modify workers kv variables from the control panel

I’m having trouble (tried three different browsers) modifying the environment variables to allow my worker to access my kv store - is it broken for anyone else?

I looked in my network logs and nothing is being blocked - and I don’t have any errors or anything when trying to configure it.

Clicking the save button FYI does nothing, so I can’t access my KV stores from my worker since I can’t set the environment values.

You need to add the bindings and then deploy the script in the editor, binding only, is not enough.

1 Like

I can’t modify it to begin with - I’ve deployed my worker already and it’s live on my website - but I can’t modify the configuration variables still.

I see what you mean, there’s a bug in the new Workers panel.
It’s not possible to save changed KV bindings… @harris Can you confirm?

Meanwhile, you can change the bindings in the old Workers panel.

Do this:

  1. Choose the domain that has the worker script.
  2. Go to “Workers” tab.
  3. Click “Launch editor”
  4. Click the “Resources” tab.
  5. Add the bindings here.
  6. Go to the “Code” tab and press “Deploy”.

Now the bindings should work.

How long does it take to take effect? I still can’t seem to access it inside my code.

It’s available immediately.

Are you sure you’re using the right method?

Test your key like this:

const myKeyContent = await bindingName.get('someKeyname')`;
console.log(myKeyContent);

Exchange bindingName with the binding that you have set.

Notice the use of await, if you don’t use that the function will return a response before it’s even fetched the key.

It’s not accessing the value, it’s accessing the bindingName at all is causing a syntax error - example:

ReferenceError: bindingName is not defined

Of course replace bindingName with my variable name - not yours.

And you are sure that you added the namespace and then saved the script in the panel?

If you save the script via wrangler or anything else, the bindings will not be saved.

Yes, since the bindings are now visible in the new Workers control panel.

Then there’s only one thing that comes to mind.

Create a completely new namespace and then create a binding to that namespace.

(Olders namespaces that where from the beta period don’t really work any more)

I created the namespaces yesterday night but I can try again I guess.

Then something must be wrong, if making a new one doesn’t work, please create a ticket.

Yep, created a new namespace and re-associated by recreating the binding and still didn’t work. I already had a ticket open - will add this info to it.

Thank you so much for the help.

1 Like

Great, let me know if it get resolved and what happend curious :slight_smile:

So my current solution is to use the command line tool Wrangler - so using the cloudflare dashboard at all is not a option right now. So KV does work, but not the dashboard at all.

That’s hopefully a temporary solution.

I create the namespace using wrangler kv:namespace blogPosts and add the configuration setting it outputs to my wrangler.toml

No, I’m not able to reproduce this – the Save button always works for me, regardless of whether it’s a new worker, an existing worker with no bindings, or an existing worker with existing bindings. Could you share exact steps on how to express the problem?

3 Likes

Hm, it works now. When I pressed save, nothing happend - when i checked the console, no errors and in the network I got an “OK” reply. But nothing was saved and the button didn’t show any progress. Maybe it was something temporary, you do release new dashboard quite often… :smiley:

1 Like