Sean Knowles
Sean Knowles3mo ago

DenoKV - Missing DENO_KV_ACCESS_TOKEN environment

Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags
error: Uncaught (in promise) NotFound: Missing DENO_KV_ACCESS_TOKEN environment variable. Please set it to your access token from https://dash.deno.com/account.: environment variable not found
const kv = await Deno.openKv(kvUrl)
Learn more at: https://docs.deno.com/runtime/manual/tools/unstable_flags
error: Uncaught (in promise) NotFound: Missing DENO_KV_ACCESS_TOKEN environment variable. Please set it to your access token from https://dash.deno.com/account.: environment variable not found
const kv = await Deno.openKv(kvUrl)
Can't find much info in the docs to be able to set this, where do we set it? I tried to pass a second option to the DenoKV() to set the accessToken, but it didn't work.
No description
2 Replies
iuioiua
iuioiua3mo ago
DENO_KV_ACCESS_TOKEN is an environment variable. You can set it the same you would when running any task in the CLI. On POSIX systems, it'd be run like so:
DENO_KV_ACCESS_TOKEN=abc123 deno run --unstable-kv script.ts
DENO_KV_ACCESS_TOKEN=abc123 deno run --unstable-kv script.ts
Similarly, on Windows using set.
Sean Knowles
Sean KnowlesOP3mo ago
@iuioiua is the any chance we could get this setup to be passed to Deno.openKV() as an argument, we have multiple kv stores and would be much easier to manage the config /env in code.... Deno.openKv({}, {token: abc123}) This would be much nicer. This way we could explicitly set which KV backend we are connecting to Nope its not working Yep latest canary not working!