tursodatabase / libsql-client-ts

TypeScript/JavaScript client API for libSQL
https://docs.turso.tech/sdk/ts/quickstart
MIT License
283 stars 37 forks source link

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

Open thomasvanvelzen opened 7 months ago

thomasvanvelzen commented 7 months ago

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)
baginskijakub commented 7 months ago

same here

Aft1n commented 5 months ago

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?