tursodatabase / tursodatabase/libsql-client-ts
Since libsql/client 5.0: TypeError: not enough arguments at new Database (local replica)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 576
- Forks
- 69
- PR merge metrics
- No merged PRs in 30d
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure from src/db/index.ts using the provided createClient configuration, then inspect the call from @libsql/client/lib-esm/sqlite3.js into node_modules/libsql/index.js. Determine why the local replica reaches databaseOpenWithRpcSync with insufficient arguments and verify that the documented configuration creates the client successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, sqlite, typescript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100