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

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

Open thomasvanvelzen opened this issue 1 year ago • 3 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)

thomasvanvelzen avatar Mar 28 '24 12:03 thomasvanvelzen

same here

baginskijakub avatar Apr 06 '24 06:04 baginskijakub

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?

Aft1n avatar Jun 12 '24 10:06 Aft1n