Guys, the problem still exists, I've deleted KV, but due to GraphQL Api, the counter continue to inc

Guys, the problem still exists, I've deleted KV, but due to GraphQL Api, the counter continue to increase.. { "dimensions": { "namespaceId": "00000000000000000000000000000000" }, "sum": { "requests": 19378341 } } ] and this 19378341 is higher than it was half an hour ago..
12 Replies
Unknown User
Unknown User4mo ago
Message Not Public
Sign In & Join Server To View
James Eastham
James Eastham3mo ago
Hey everyone, is there any way to react to a key expiring in KV? Almost like change data capture so I can run some code on expiry
Hello, I’m Allie!
There is not, no. Though you could trigger some code yourself when you do a write?
Isaac McFadyen
Isaac McFadyen3mo ago
I think they specifically want expiry, not write?
James Eastham
James Eastham3mo ago
Yeah, specifically on expiry is what I was looking for.
Hello, I’m Allie!
Oh… Don’t add a TTL, but instead use a DO Alarm that also calls the expiry handler?
James Eastham
James Eastham3mo ago
Oooo, I did not know DO alarms existed, but yes this looks like exactly what I need ☺️☺️
Jando
Jando3mo ago
Hey has anyone gotten the KV's to work for the nuxt app without using nuxthub?
Jando
Jando3mo ago
Cloudflare Docs
Nuxt | Cloudflare Pages docs
Web framework making Vue.js-based development simple and powerful.
Jando
Jando3mo ago
export default defineEventHandler(async ({ context }) => {
console.log(context)
console.log(context.cloudflare)
console.log('-=-==-=-=-=-=-s')
console.log(context.cloudflare.env)
console.log("HERE")
const ARCKV = context.cloudflare.env.ARCKV;

const kvList = await context.cloudflare.env.ARCKV.list();
const value = await context.cloudflare.env.ARCKV.get("123");
const save = await context.cloudflare.env.ARCKV.set('Testing', "5678")

console.log(save)

console.log(kvList)
console.log(value)

let full_obj = await ARCKV.list()

console.log(full_obj)

console.log("BEFORE KV")
console.log(ARCKV)

return kvList;
});
export default defineEventHandler(async ({ context }) => {
console.log(context)
console.log(context.cloudflare)
console.log('-=-==-=-=-=-=-s')
console.log(context.cloudflare.env)
console.log("HERE")
const ARCKV = context.cloudflare.env.ARCKV;

const kvList = await context.cloudflare.env.ARCKV.list();
const value = await context.cloudflare.env.ARCKV.get("123");
const save = await context.cloudflare.env.ARCKV.set('Testing', "5678")

console.log(save)

console.log(kvList)
console.log(value)

let full_obj = await ARCKV.list()

console.log(full_obj)

console.log("BEFORE KV")
console.log(ARCKV)

return kvList;
});
I can list an get but theres nothing in the response I checked the wrangler config etc Im not sure if theirs something extra I need to do for pages
import {
CfProperties,
Request,
ExecutionContext,
KVNamespace,
} from "@cloudflare/workers-types";

declare module "h3" {
interface H3EventContext {
cf: CfProperties;
cloudflare: {
request: Request;
env: {
ARCKV: KVNamespace;
};
context: ExecutionContext;
};
}
}
import {
CfProperties,
Request,
ExecutionContext,
KVNamespace,
} from "@cloudflare/workers-types";

declare module "h3" {
interface H3EventContext {
cf: CfProperties;
cloudflare: {
request: Request;
env: {
ARCKV: KVNamespace;
};
context: ExecutionContext;
};
}
}
✨ Compiled Worker successfully
Your worker has access to the following bindings:
- KV Namespaces:
- ARCKV: ---------hidden but there --------
[wrangler:inf] Ready on http://localhost:8788
⎔ Starting local server...
✨ Parsed 0 valid redirect rules.
✨ Parsed 3 valid header rules.
[wrangler:inf] GET / 200 OK (32ms)
✨ Compiled Worker successfully
Your worker has access to the following bindings:
- KV Namespaces:
- ARCKV: ---------hidden but there --------
[wrangler:inf] Ready on http://localhost:8788
⎔ Starting local server...
✨ Parsed 0 valid redirect rules.
✨ Parsed 3 valid header rules.
[wrangler:inf] GET / 200 OK (32ms)
It seems to be initnalized aswell anyone know what could be going on here? I figured it out by reading throught the plugins docs it these ones should be updated to include you need to process like this
export default eventHandler(async (event) => {
const { ARCKV } = event.context.cloudflare.env;

console.log(ARCKV)
let test = await ARCKV.list()
console.log(test)

let ctr = (await ARCKV.get("counter")) || 0;
await ARCKV.put("counter", ++ctr % 100);

return `counter: ${(await ARCKV.get("counter")) || 0}`;
});
export default eventHandler(async (event) => {
const { ARCKV } = event.context.cloudflare.env;

console.log(ARCKV)
let test = await ARCKV.list()
console.log(test)

let ctr = (await ARCKV.get("counter")) || 0;
await ARCKV.put("counter", ++ctr % 100);

return `counter: ${(await ARCKV.get("counter")) || 0}`;
});
you cant use the context as listed on the wrangler docs!
Unknown User
Unknown User3mo ago
Message Not Public
Sign In & Join Server To View
Corentin
Corentin3mo ago
Hi there! When keys are removed due to TTL expiration using the expirationTtl option, do those removals count toward the delete request quota ? Thanks!
Want results from more Discord servers?
Add your server