tursodatabase / tursodatabase/libsql-client-ts

BUG: Fail to import @libsql/client in node < 18

Open
#210 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hello there!

According to the docs, it's compatible with node version 12 or later. But it seems to fail in node 16 as I ran into an error when importing @libsql/client or @libsql/client/web:

.../node_modules/@libsql/isomorphic-fetch/node.cjs:3
const _Request = Request;
                 ^

ReferenceError: Request is not defined

Upon searching, almost all answers seem to suggest upgrading to node 18.

For now, I can take advantage of using libsql-js instead, but it seems like it doesn't support returning rows in array form https://github.com/tursodatabase/libsql-js/issues/116. Would love to learn to resolve these issues! :)

Note: @libsql/client/sqlite3 works fine, but I feel like it only supports file based or :memory: database?

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 by reproducing the import of @libsql/client and @libsql/client/web under Node 16, then compare it with the working @libsql/client/sqlite3 entry point. Inspect the reported failure in @libsql/isomorphic-fetch/node.cjs and verify that the documented Node 12+ compatibility works without the ReferenceError; preserve the behavior noted for sqlite3.

Written by the indexing model from the issue text.

Assessment

Tech stack
nodejs, typescript
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.