DenoDDeno
Powered by
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);
//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
DENO_KV_ACCESS_TOKEN
exported into my shell and when I run
deno run --unstable main.ts
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
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
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Deno KV on deno deploy
MolanMMolan / help
11mo ago
Dates in Deno KV
vwkdVvwkd / help
7mo ago
Using Deno.KV twice
jsJjs / help
2y ago
Clear deno kv db
Online JesterOOnline Jester / help
3y ago