Cloudflare Developers

CD

Cloudflare Developers

Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news

Join

You're quite close!

You're quite close! Two small changes needed: - KV = "TEST" assigns the string to the KV variable, instead of the KV namespace. In the old service worker syntax, removing this line would've been your solution, as bindings were global variables. In module workers (ones with export default), they are available on the env variable which is the second parameter of your fetch function in line 4, so on line 5 and 6 you should change it to env.KV.put and env.KV.get. - You'll need to actually bind your worker to this KV namespace you created, which in the dashboard you can do by clicking on Workers & Pages, selecting your worker, clicking on the Settings tab, and scrolling down to KV Namespace bindings. There, you'll need to select the KV namespace you created (Edit Variables, Add binding) and give it a name that it will be made available as (KV in the example). Saving it should create a new deployment where the namespace you selected is available as env.KV meowparty

And note too, if you are using local dev

And note too, if you are using local dev, then the KV Namespace doesn't have to exist at all, so you can just use a random string as an id

Hey team. We are seeing an interesting

Hey team. We are seeing an interesting behaviour were a KV entry appears to have been added 5 hours after it was originally created and then deleted. I understand that KV is an eventually consistent store... but find it unlikely that there could've been a 5 hour gap between replication. Any tips on what debugging we can do to understand why a certain key appeared in our KV store when we didn't expect it? I also see there is no way for us to verity that a kb.delete call would have actually removed a real key from the store....

I m having a problem with my KV Cache I

I'm having a problem with my KV Cache. I get this error "this.kv.get is not a function" and I can't figure out why. Here is my implementation ```typescript import type { KVNamespace } from '@cloudflare/workers-types' export type KVCacheInstanceType<T> = InstanceType<typeof KVCache<T>>...

Hey so sorry clearly I didn t explain

Hey, so sorry, clearly I didn't explain myself very well haha. Basically, I have little open source project that creates a remote-cache server using workers. It currently uses a "one click deployment" button that cloudflare provides. Button - https://developers.cloudflare.com/workers/configuration/deploy-button/ Project - https://github.com/AdiRishi/turborepo-remote-cache-cloudflare...

Your findings are not wrong there is

Your findings are not wrong - there is currently no command to create and manipulate local binding mocks - you'd have to recreate it with a worker if you want this functionality today. cc @admah a good number people were looking for this just in the last week, might be worth considering since local dev mode is now the default

KV is pull based so the data is stored

KV is pull-based so the data is stored in two central locations and cached at the colo the .get runs in for 60 seconds (default) - you can cache it for longer with .get(key, { cacheTtl: seconds }); if you wasn't already it depends what you're doing though - some things are faster to do in the worker everytime than they might be to cache in Cache API/KV & pull from...

No You would have to store the value in

No. You would have to store the value in DO storage, push to it, and then update the stored value and KV

ToS and non-HTML content

So... because the conversation around the ToS has come up again when it comes to images/videos and other "non-HTML" content, I have contacted legal, and as long as you use any of the Cloudflare Development platform products to either store or process them, you are not bound by 2.8 of the general Terms of Service, but by the supplemental terms, which does allow serving of non-HTML content. So it is possible to use KV to store images and workers to serve them. What isn’t 100% clear right now is if you can use the Cache API to cache such content....

I know I saw this in here before but

I know I saw this in here before but cant seem to find any resolution to it... I'm currently getting errors saying my cursor is invalid and not sure how to fix 🤔 My code looks like so: ```ts let cursor: string | undefined, complete = false...