libsql-client-ts icon indicating copy to clipboard operation
libsql-client-ts copied to clipboard

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

Open haingdc opened this issue 5 months ago • 1 comments

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/[email protected]/node_modules/libsql/index.js:89:17)
    at _createClient (file:///Volumes/ADATA_SSD/coding/temp/deno/joplin-secretary/landing/node_modules/.deno/@[email protected]/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/@[email protected]/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/@[email protected]/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 [email protected] that throw the error. I try to explicit [email protected], by deno add npm:[email protected] then edit deno.lock file:

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

It then works as normal

haingdc avatar Aug 27 '25 11:08 haingdc

Having issues when upgrading from @0.5.12 to @0.5.14 as well. Not related, but mine is when using it with drizzle-kit I get the error below when running $ drizzle-kit studio

Please install '@libsql/client' for Drizzle Kit to connect to LibSQL databases

Downgrading to @0.5.12 fixes it

joshxfi avatar Aug 30 '25 02:08 joshxfi