Skip to content

Can't connect and get data from a Deno KV deployed on Deno Deploy EA (can on Deno Deploy Classic) #129

@AbdulrhmanGoni

Description

@AbdulrhmanGoni

Issue Description

Connecting to a remote Deno Kv database deployed on Deno Deploy Classic works fine,
But connecting to one deployed on Deno Deploy EA doesn't!,
Instead, it responds with "The authorization token is not valid" error (though I just created the access token, copied and set it correctly)

Am i missing something 🤔?

The versions I used:

Reproduce the error

You need to provision a Deno Kv database in Deno Deploy EA and bring a personal access token

In Deno runtime

Deno.env.set("DENO_KV_ACCESS_TOKEN", "ddp_...")
const kv = await Deno.openKv("https://api.deno.com/databases/<DB_ID>/connect")
console.log(await kv.get(["any-random-key"]))

In Node runtime + @deno/kv package

import { openKv } from "@deno/kv";
Deno.env.set("DENO_KV_ACCESS_TOKEN", "ddp_...")
const kv = await openKv("https://api.deno.com/databases/<DB_ID>/connect")
console.log(await kv.get(["any-random-key"]))

Run

deno run -A --unstable-kv test.ts

You should now see something like this:

error: Uncaught (in promise) Error: Failed to fetch metadata: {
   "code": "invalidToken",
   "message": "The authorization token is not valid: The bearer token is invalid."
 }
 console.log(await kv.get(["any-random-key"]))

The error seems coming from kv.get method

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions