tursodatabase / tursodatabase/libsql-js

SQLiteError triggers TypeError in Bun

Open
#187 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
335
Forks
48
Avg merge
3d 2h
Merged PRs (30d)
3

Description

When using Bun as the runtime and a local DB file, whenever a SqliteError is thrown, a TypeError is actually thrown.

TypeError: First argument must be an Error object
      at new SqliteError (/Users/simon/Code/Github/project/node_modules/libsql/sqlite-error.js:22:8)
      at convertError (/Users/simon/Code/Github/project/node_modules/libsql/index.js:60:10)
      at run (/Users/simon/Code/Github/project/node_modules/libsql/index.js:353:10)

I dug a little and found a few things:

Not sure why it works with a Turso DB. I suspect that Node & Bun validates Error differently.

Contributor guide

No contributing guide indexed for this repository

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

Reproduce the error with Bun and a local database, then start at sqlite-error.js line 14 and trace the call through convertError and run in libsql/index.js. Compare the local SQLite and Turso paths, with the goal that a thrown SQLite error remains a SqliteError rather than becoming a TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
bun, javascript, sqlite
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.