Unable to write KV values from within Workers

#1

I’m unable to write anything to KV from within workers.

Works fine via API and I’ve tested on different domains and different KV Namespaces.

I know this is in “Beta” but not working at all… ?

0 Likes

#2

Is bind properly to worker script? I had issue in the passed that it failed to bind. It is a dashboard issue.

0 Likes

#3

That’s what i expected, so I tried values that where already bound and then tried with a fresh worker on a separate domain with a simple bind test = namespace. Still the same issue, nothing get written.

0 Likes

#4

After doing some tests, it seems that NOTHING is written if i refresh the workers page a single time.

But, if i refresh it quickly a few times - a single value is written to the KV.

I tested this using a simple: something.put(''+Math.random(), 'hello');

Because at first i thought it took time for the value to be written (eventually consistent) but that is NOT the case.

EDIT: Also, no matter how many times i refresh the Worker Editor or run the Worker Test page, I cannot get it to write a value - I have to load the actual public page for the worker and refresh this page several times for it to write a value to the KV.

0 Likes

#5

I’m guessing someone saw the issue, because now it writes the value on refresh…

0 Likes

#6

I’m still unable to write values using my original domain, even with a fresh KV.

Not sure if this is related to the issue:

53%20PM

0 Likes

#7

Found the issue, it’s because I send a response directly after writing to the KV without await and that completely cancels writing the value.

This wasn’t the case before, but now it is… apparently.

Please update the Docs so others don’t have to pull their hair out.

1 Like

#8

I can absolutely see why that would be exceptionally frustrating! I’m sorry you had to struggle through that @thomas4.

1 Like

#9

No worries, would have been worse if it was a systematic issue.

0 Likes