#deploy error - TypeError: Deno.openKv is not a function

5 messages · Page 1 of 1 (latest)

thorny holly
#

Hi, I am taking a SQL class which also uses DENO - needless to say, this is my first experience with DENO.

I am using a main.ts script (from https://github.com/csev/deno-kv-admin/blob/main/main.ts) and when I run deploy (from the playground) I get the following error message:
TypeError: Deno.openKv is not a function
at file:///app/src/main.ts:7:23

error: Uncaught (in promise) TypeError: Deno.openKv is not a function
const kv = await Deno.openKv();
^
at file:///app/src/main.ts:7:23

info: Deno.openKv() is an unstable API.
hint: Run again with `--unstable-kv` flag to enable this API.

TypeError: Deno.openKv is not a function
at file:///app/src/main.ts:7:23

  1. where do I run the hint ( hint: Run again with --unstable-kv flag to enable this API.)??? It may be clear to you, but it sure isn't to me

  2. Would using the old environment ("classic" which can be used until June 25 this year) make a difference? How do I even get to it? It showed when I first entered, but is not now...

  3. Could someone explain to me what is going on?

robust kindle
#

Oh yeah, I had a similar issue like this before. The place you add the --unstable-kv in would be in the deno.json file.

Look for two things:

  • the command that runs your code in dev mode
  • the command that runs the build script

For each of them, look for any existing flags, and add that unstable kv flag there.

I can't comment on Question 2, I haven't had a need to think along those lines.

Answer to question 3 is that the kv feature hasn't been tested enough to be considered a part of the stable branch of features that deno typically provides.

So to prevent it from being used in environments where stability is of utmost importance, it's been locked away behind a flag, so that you explicitly know you're using an unstable feature.

thorny holly
# robust kindle Oh yeah, I had a similar issue like this before. The place you add the `--unstab...

Okay, this should do it, but - how do I access this deno.json file? I am using the web for access (no idea how to access deno from the terminal (I run linux, so a terminal is a standard feature)) and I don't see a way to access the code outside my own script. While we are at it - I am a student, not an organization. Should I verify my 'organization'? Would that mean entering the paid plans (right now I am using the 'free' one)

robust kindle
# thorny holly Okay, this should do it, but - how do I access this deno.json file? I am using t...

I am using the web for access

I don't see a way to access the code outside my own script.

Maybe ask your school/uni about this then. Typically the deno.json file lives at the root directory of your project. If you have access to that, you should be able to find it.

I am a student, not an organization. Should I verify my 'organization'?

For using --unstable-kv? I don't think you need to verify your organization for that iirc

glass mason
#
{
  "unstable": ["kv"]
}

Add this to your deno.json