tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL

Home Page:https://docs.turso.tech/sdk/ts/quickstart

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Since libsql/client 5.0: TypeError: not enough arguments at new Database (local replica)

thomasvanvelzen opened this issue · comments

I'm getting this error since upgrading to libsql/client 5.0. The config for createClient is as follows:
{
url: "file:local.db",
syncUrl: config.env.DATABASE_URL,
authToken: config.env.DATABASE_AUTH_TOKEN!,
}

this should work according to the examples provided. The values are not null and work as expected when connecting to the remote db.

$ bun run --watch src/index.ts
63 |       } else if (opts.authToken) {
64 |           authToken = opts.authToken;
65 |       }
66 |       const encryptionKey = opts?.encryptionKey ?? "";
67 |       const syncPeriod = opts?.syncPeriod ?? 0.0;
68 |       this.db = databaseOpenWithRpcSync(path, opts.syncUrl, authToken, encryptionCipher, encryptionKey, syncPeriod);
                     ^
TypeError: not enough arguments
      at new Database (.../node_modules/libsql/index.js:68:17)
      at _createClient (.../node_modules/@libsql/client/lib-esm/sqlite3.js:39:16)
      at .../src/db/index.ts:22:23
      at processTicksAndRejections (:61:77)
63 |       } else if (opts.authToken) {
64 |           authToken = opts.authToken;
65 |       }
66 |       const encryptionKey = opts?.encryptionKey ?? "";
67 |       const syncPeriod = opts?.syncPeriod ?? 0.0;
68 |       this.db = databaseOpenWithRpcSync(path, opts.syncUrl, authToken, encryptionCipher, encryptionKey, syncPeriod);
                     ^
TypeError: not enough arguments
      at new Database (.../node_modules/libsql/index.js:68:17)
      at _createClient (.../node_modules/@libsql/client/lib-esm/sqlite3.js:39:16)
      at.../src/db/index.ts:22:23
      at processTicksAndRejections (:61:77)

same here

Version 0.6.2. Still have this error in ElysiaJs. Any workarounds? How can this error be present for more than 2 months if that's the main way to connect your app to turso?