kv.watch() not working

for await (const entry of kv.watch([['chat']])) console.log(entry);
for await (const entry of kv.watch([['chat']])) console.log(entry);
The only thing this does is immediately prints the following:
[ { key: [ "chat" ], value: null, versionstamp: null } ]
[ { key: [ "chat" ], value: null, versionstamp: null } ]
What it's supposed to do is print each new entry added to the database under key "chat", but it doesn't. I can prove the entries are being added by running this inside an interval every couple seconds:
console.log(await Array.fromAsync(kv.list({ prefix: ['chat'] })));
console.log(await Array.fromAsync(kv.list({ prefix: ['chat'] })));
1 Reply
MelerEcckmanLawler
I also want to point out that, as others have already noted, relying on Discord as your primary avenue of support is very unprofessional and obnoxious. ChatGPT solved this for me. Evidently kv.watch() only watches for changing to a specific entry.

Did you find this page helpful?