FairAimBot
FairAimBot4mo ago

ISOLATE_INTERNAL_FAILURE using KV

Hello! I've used Deno KV in the past, but just today whenever I try to deploy a new project, everytime I get:
Project linked to GitHub
Downloaded file:///src/test.ts (1/1)
Packaging complete
The deployment failed: ISOLATE_INTERNAL_FAILURE
Project linked to GitHub
Downloaded file:///src/test.ts (1/1)
Packaging complete
The deployment failed: ISOLATE_INTERNAL_FAILURE
The project is just a copy/paste from the KV example documentation, so I'm unclear why this is failing? Any pointers y'all have are welcome! Here's the repo: https://github.com/aaronhmiller/kv-test and here's the code:
const kv = await Deno.openKv();
enum Rank {
Bronze,
Silver,
Gold,
}

interface Player {
username: string;
rank: Rank;
}
const player1: Player = { username: "carlos", rank: Rank.Bronze };
const player2: Player = { username: "briana", rank: Rank.Silver };
const player3: Player = { username: "alice", rank: Rank.Bronze };
await kv.set(["players", player1.username], player1);
await kv.set(["players", player2.username], player2);
await kv.set(["players", player3.username], player3);
player3.rank = Rank.Gold;
await kv.set(["players", player3.username], player3);
const record = await kv.get(["players", "alice"]);
const alice: Player = record.value as Player;
console.log(record.key, record.versionstamp, alice);
const [record1, record2] = await kv.getMany([
["players", "carlos"],
["players", "briana"],
]);
console.log(record1, record2);
const records = kv.list({ prefix: ["players"] });
const players = [];
for await (const res of records) {
players.push(res.value as Player);
}
console.log(players);
await kv.delete(["players", "carlos"]);
const aliceScoreKey = ["scores", "alice"];
await kv.set(aliceScoreKey, new Deno.KvU64(0n));
await kv.atomic()
.mutate({
type: "sum",
key: aliceScoreKey,
value: new Deno.KvU64(10n),
})
.commit();
const newScore = (await kv.get(aliceScoreKey)).value;
console.log("Alice's new score is: ", newScore);
const kv = await Deno.openKv();
enum Rank {
Bronze,
Silver,
Gold,
}

interface Player {
username: string;
rank: Rank;
}
const player1: Player = { username: "carlos", rank: Rank.Bronze };
const player2: Player = { username: "briana", rank: Rank.Silver };
const player3: Player = { username: "alice", rank: Rank.Bronze };
await kv.set(["players", player1.username], player1);
await kv.set(["players", player2.username], player2);
await kv.set(["players", player3.username], player3);
player3.rank = Rank.Gold;
await kv.set(["players", player3.username], player3);
const record = await kv.get(["players", "alice"]);
const alice: Player = record.value as Player;
console.log(record.key, record.versionstamp, alice);
const [record1, record2] = await kv.getMany([
["players", "carlos"],
["players", "briana"],
]);
console.log(record1, record2);
const records = kv.list({ prefix: ["players"] });
const players = [];
for await (const res of records) {
players.push(res.value as Player);
}
console.log(players);
await kv.delete(["players", "carlos"]);
const aliceScoreKey = ["scores", "alice"];
await kv.set(aliceScoreKey, new Deno.KvU64(0n));
await kv.atomic()
.mutate({
type: "sum",
key: aliceScoreKey,
value: new Deno.KvU64(10n),
})
.commit();
const newScore = (await kv.get(aliceScoreKey)).value;
console.log("Alice's new score is: ", newScore);
GitHub
GitHub - aaronhmiller/kv-test
Contribute to aaronhmiller/kv-test development by creating an account on GitHub.
1 Reply
FairAimBot
FairAimBotOP4mo ago
Not yet sure why this is, but the app deploys if I add a middleware like Oak and add some routes. Then it doesn't throw the ISOLATE_INTERNAL_FAILURE error. Perhaps the Deno Deploy environment requires that apps define routes and throws errors if they're not there. Regardless, adding them in, even if unused, allowed the deploy to finally work! the repo has the updated, working code.