tigawana
tigawana
DDeno
Created by tigawana on 1/2/2024 in #help
deno deploy queues
this too isn.t working , only locally , am i doing it wrong?
4 replies
DDeno
Created by tigawana on 1/2/2024 in #help
deno deploy queues
ohh, something like this ?
const db = await Deno.openKv();
db.listenQueue(async (msg) => {
const data = msg as { channel: string; text: string };
console.log("=== QUEUE MESSAGE === ", data);
await db.set(["test-queues", data.channel], data.text);
console.log("saved to kv ==== ",await db.get(["test-queues", data.channel]));
});

app.get('/test', async(c) => {
try {
const env = await load();
// const db = await Deno.openKv();

// db.listenQueue(async(msg) => {
// const data = msg as { channel: string; text: string };
// console.log("=== QUEUE MESSAGE === ",data);
// await db.set(["test-queues", data.channel], data.text);
// });

await db.enqueue({ channel: "C123456", text: "Slack message" }, {
delay: 0,
});
return c.json({
env,
})
} catch (error) {
return c.text("error with queues === "+error.message, 401);
}
})
const db = await Deno.openKv();
db.listenQueue(async (msg) => {
const data = msg as { channel: string; text: string };
console.log("=== QUEUE MESSAGE === ", data);
await db.set(["test-queues", data.channel], data.text);
console.log("saved to kv ==== ",await db.get(["test-queues", data.channel]));
});

app.get('/test', async(c) => {
try {
const env = await load();
// const db = await Deno.openKv();

// db.listenQueue(async(msg) => {
// const data = msg as { channel: string; text: string };
// console.log("=== QUEUE MESSAGE === ",data);
// await db.set(["test-queues", data.channel], data.text);
// });

await db.enqueue({ channel: "C123456", text: "Slack message" }, {
delay: 0,
});
return c.json({
env,
})
} catch (error) {
return c.text("error with queues === "+error.message, 401);
}
})
4 replies
DDeno
Created by tigawana on 12/27/2023 in #help
Remote KV access error : Missing DENO_KV_ACCESS_TOKEN environment variable
no , am not pssing in --env
6 replies
DDeno
Created by tigawana on 12/27/2023 in #help
Remote KV access error : Missing DENO_KV_ACCESS_TOKEN environment variable
.env
6 replies
DDeno
Created by tigawana on 12/26/2023 in #help
List kv items using a partial key
Thank you even more
6 replies
DDeno
Created by tigawana on 12/26/2023 in #help
List kv items using a partial key
Thanks guys it worked
6 replies