Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KV without path will not persist data if compiled #24318

Open
K0IN opened this issue Jun 23, 2024 · 0 comments
Open

KV without path will not persist data if compiled #24318

K0IN opened this issue Jun 23, 2024 · 0 comments
Labels
bug Something isn't working correctly compile related to the `deno compile` feature ext/kv Related to "Deno.openKv()" API

Comments

@K0IN
Copy link

K0IN commented Jun 23, 2024

Version: Deno 1.44.4 (release, x86_64-pc-windows-msvc) (same behaviour on Linux)
v8 12.6.228.9
typescript 5.4.5

When compiling a script that uses DenoKv, it fails to persist data.
This can be fixed by supplying a path to Deno.openKv, which is bad since i need to change my script for the environment it would run in (deno run and deno deploy vs deno compile).

There might be similar issues, see:
#10693

minimal reproducible example:

const kv = await Deno.openKv(); // setting a persistant path here, will store the data
const key = ["device", "key"];
await kv.set(key, "hi deno team.");
kv.close();

const kv2 = await Deno.openKv(); // setting a persistant path here, will read the data
const {value} = await kv2.get(key);
console.log(value); // Expected Output: hi deno team.
kv2.close();

Works fine

deno run --allow-all --unstable-kv main.ts

Does not work

deno compile --allow-all --unstable-kv -o main main.ts
./main

This is a bug, since from the Deno.openKv() I would assume that it would work without a path.
See: https://deno.land/[email protected]?s=Deno.openKv

I also tried setting --location on deno compile, but same issue.

@satyarohith satyarohith added bug Something isn't working correctly compile related to the `deno compile` feature ext/kv Related to "Deno.openKv()" API labels Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly compile related to the `deno compile` feature ext/kv Related to "Deno.openKv()" API
Projects
None yet
Development

No branches or pull requests

2 participants