sql-js / sql-js/sql.js

"fetch" api included in NodeJS v18 brokes sql.js

Open
#528 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
13.7k
Forks
1.1k
PR merge metrics
No merged PRs in 30d

Description

NodeJS 18 includes experiential support for the "fetch" api. This is causing sql.js not to work properly after Node v18. Because it checks if there is an global "fetch" funcion exists. If so it tries to fetch the wasm file.

sql-wasm.js
.... "function"!=typeof fetch?c(b):fetch(P,{credentials:"same-origin"}) .....

This check is invalid for NodeJS v18.

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 inspecting sql-wasm.js, especially the fetch check shown in the issue, and compare its behavior under NodeJS 18. Determine how the NodeJS environment should load the wasm file when a global fetch function exists. Done means sql.js works correctly in NodeJS 18 without incorrectly trying to fetch the wasm file.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.