25mb is the limit per KV value. It can hold any value up to 25mb indefinitely, yes.
25mb is the limit per KV value. It can hold any value up to 25mb indefinitely, yes.


metadata is supposedly optional, but required in the type definition within the cloudflare-typescript library.metadata object on your writes to KV! WRONG!!{ value: XYZ, metadata: {}}. Not super intuitive, I'd rather just store XYZ. So then I learned:metadata, you actually need to include the Content-Type: multipart/form-metadata header (image 1, link). The library has some handling for automatically including this header, but it doesn't catch these cases where we're forced to pass in empty metadata {"code":10047,"message":"can not parse value and metadata from multipart request body: 'could not parse multipart request: 'no multipart boundary param in Content-Type''"}Content-Type: multipart/form-data; boundary=asfghjkl?.value on your GET response from KV, potentially running into issues when this finally gets fixed? Or did you manually pass in a fancy header? Or something else I am forgetting?


just getting the value and incrementing it would be too inefficient since it would be two requests to the KV every time the button is clicked.Not only that, KV is eventually consistent. If you do a
get() in one datacenter and then increment and a put(), another datacenter might not see it for up to 60 seconds so that datacenter might also do a get() and a put() (using the stale value) and then your counter is no longer consistent since a write would be lost.
cloudflare typescript SDK, which resolves the metadata bug reported above with workers kv updates and reads. You are now able to write, update & read the metadata from the typescript SDK! Go try it out npm i cloudflare. There are 124 other projects in the npm registry using cloudflare.
list() call (which is billed) or a get()/getWithMetadata() call (which is also billed). So yes.waitUntil() to avoid delaying the request.


const keys = await env.NAMESPACE.list();
Promise.all(keys.map(async (key) => {
const v = env.NAMESPACE.get(key.name);
console.log(v);
}))const state = ulid(Date.now());
const stateData: StateData = {
returnTo: safeReturn,
codeVerifier: verifier,
createdAt: Date.now(),
expiresAt: Date.now() + this.STATE_TTL_MS
};
await this.stateDatabase.set(state, JSON.stringify(stateData), {
expirationTtl: this.STATE_TTL_MS
});metadatametadatametadatacloudflare-typescript{ value: XYZ, metadata: {}}Content-Type: multipart/form-metadata{"code":10047,"message":"can not parse value and metadata from multipart request body: 'could not parse multipart request: 'no multipart boundary param in Content-Type''"}Content-Type: multipart/form-data; boundary=asfghjkl.value