NicoN
Denoβ€’3y agoβ€’
1 reply
Nico

Trouble accessing Deno KV via the Deno CLI

I'm trying to connect to a Deno KV via the CLI with the following simple code:

//main.ts
const kv = await Deno.openKv(
  "https://api.deno.com/databases/d7822b57-b261-4c64-bbe4-41d5f981aacb/connect"
);

const result = kv.set(["foo"], "bar");
console.log(result);


I have an access token set up in my account settings, as shown in the first screen shot. I also have an environment variable DENO_KV_ACCESS_TOKEN exported into my shell and when I run deno run --unstable main.ts, I allow access to that variable as shown int he second screenshot but I get the following error: Uncaught NotFound: Missing DENO_KV_ACCESS_TOKEN environment variable. Please set it to your access token from https://dash.deno.com/account

Why is this happening?
Screenshot_2023-10-30_at_10.25.56_PM.png
Screenshot_2023-10-30_at_10.27.42_PM.png
Was this page helpful?