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
RRich5/9/2024

Yikes, that's really disappointing.

Yikes, that's really disappointing. Thanks for the info. I'm coming to the realisation that CF is only really beneficial for very high traffic sites -- I wonder if all CDNs are as quick to evict cache entries....
HHurby4/11/2024

that sounds expensive

that sounds expensive
HIAHello, I’m Alastair!2/27/2024

You can't configure the KV origins. As

You can't configure the KV origins. As for an immutable Cache, would a single DO per region not work?
Jjedi2/22/2024

i got a question when reading metadata

i got a question when reading metadata from a key
DDaniFoldi11/22/2023

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
HIAHello, I’m Alastair!11/6/2023

Cloudflare API Documentation

You would probably have to call the API manually
HIAHello, I’m Alastair!11/6/2023

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
HAHady (Atlassian)10/18/2023

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....
MMBrimmer10/5/2023

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>>...
AAdi8/18/2023

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...
DDaniFoldi6/4/2023

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
Kkian12/16/2022

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...
HIAHello, I’m Alastair!11/13/2022

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
EErwin8/9/2022

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....
UUnsmart8/7/2022

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...