tursodatabase / tursodatabase/libsql-client-ts

Long-lived client object can cause "invalid baton" errors

Open
#119 8 comments 8 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
576
Forks
69
PR merge metrics
No merged PRs in 30d

Description

If you have a long-lived client object, the server can start complaining about the baton:

 LibsqlError: SERVER_ERROR: Server returned HTTP status 400: Received an invalid baton
    at (node_modules/@libsql/client/lib-esm/hrana.js:257:15)
    at (node_modules/@libsql/client/lib-esm/hrana.js:182:36)
    at (node_modules/@libsql/client/lib-esm/hrana.js:184:12)
    at (node_modules/drizzle-orm/libsql/index.mjs:38:12)
    at (node_modules/next/dist/esm/server/future/route-modules/app-route/module.js:210:36) {
  code: 'SERVER_ERROR',
  rawCode: undefined,
  name: 'LibsqlError'
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the reported failure locations in node_modules/@libsql/client/lib-esm/hrana.js at lines 182 and 257, then reproduce the error with a long-lived client object. Trace how the baton is handled around that failure; done means the reported scenario no longer returns an invalid baton and is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.