tursodatabase / tursodatabase/libsql-client-ts

Sync Error when update to version @libsql/client @0.5.14

Open
#324 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
576
Forks
69
PR merge metrics
No merged PRs in 30d

Description

I run on Deno and after update from @libsql/client @0.5.12 to @libsql/client @0.5.14. I got the below error:

import { type Client, createClient } from "@libsql/client";

const db = createClient({
  url: Deno.env.get("TURSO_URL")!,
  syncUrl: Deno.env.get("TURSO_SYNC_URL"),
  authToken: Deno.env.get("TURSO_AUTH_TOKEN"),
  syncInterval: Number(Deno.env.get("TURSO_SYNC_INTERVAL") || 3),
});
$deno run --allow-all --env-file=envs/.env test-create-client.ts
error: Uncaught (in promise) Error: sync error: invalid local state: generation is 0
    at new Database (file:///Volumes/ADATA_SSD/coding/temp/deno/joplin-secretary/landing/node_modules/.deno/libsql@0.5.20/node_modules/libsql/index.js:89:17)
    at _createClient (file:///Volumes/ADATA_SSD/coding/temp/deno/joplin-secretary/landing/node_modules/.deno/@libsql+client@0.15.14/node_modules/@libsql/client/lib-esm/sqlite3.js:49:16)
    at _createClient (file:///Volumes/ADATA_SSD/coding/temp/deno/joplin-secretary/landing/node_modules/.deno/@libsql+client@0.15.14/node_modules/@libsql/client/lib-esm/node.js:21:16)
    at createClient (file:///Volumes/ADATA_SSD/coding/temp/deno/joplin-secretary/landing/node_modules/.deno/@libsql+client@0.15.14/node_modules/@libsql/client/lib-esm/node.js:11:12)
    at file:///Volumes/ADATA_SSD/coding/temp/deno/joplin-secretary/landing/test-create-client.ts:3:12

It's using libsql@0.5.20 that throw the error. I try to explicit libsql@0.5.17, by deno add npm:libsql@0.5.17 then edit deno.lock file:

"@libsql/client@0.15.14": {
    "integrity": "sha512-oXeFYcSyAsYWvpWVmynrwNwb+NHNHtMfSIVdfQTF1B9RsgDXQE5YCDP3SS0i1FA8nuLWy2trFDVwP1b2LNdNPQ==",
    "dependencies": [
      "@libsql/core",
      "@libsql/hrana-client",
      "js-base64",
      "libsql@0.5.17", <------- LIke this
      "promise-limit"
  ]
},

It then works as normal

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Deno reproduction in test-create-client.ts and compare @libsql/client 0.5.12 with 0.5.14, focusing on the libsql dependency shown in lib-esm/sqlite3.js and libsql/index.js. Verify the client initializes and syncs without “invalid local state: generation is 0” using the supported dependency versions, then add a regression test if the project’s test entry point is identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
deno, sqlite, typescript
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.