Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
erayhanoglu opened this issue Sep 2, 2022 · 3 comments
Open

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

erayhanoglu opened this issue Sep 2, 2022 · 3 comments

Comments

@erayhanoglu
Copy link

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.

@lovasoa
Copy link
Member

lovasoa commented Sep 6, 2022

This is a good catch, but this is an emscripten issue, isn't it ? All we can do is update to a more recent emscripten when they fix the bug, right ?

@johncardiologs
Copy link

johncardiologs commented Sep 15, 2022

I'm having a perhaps related strange error:

Error: Aborted(RuntimeError: Aborted(Error: ENOENT: no such file or directory, open 'http:/localhost:8000/sql-wasm.wasm'). Build with -sASSERTIONS for more info.). Build with -sASSERTIONS for more info.
  E node_modules/sql.js/dist/sql-wasm.js:101:154
  node_modules/sql.js/dist/sql-wasm.js:158:425

Trying to serve a custom sql-wasm.wasm file for myself. Getting these errors suddenly 😬 At one point I did npm i and it said "changed 1 packaged" and then things started working again? But then when I reinstalled all my packages, on node version 18.8.0, it gave me this error. I've triple checked the url I'm passing in, and it is (correctly) http://localhost:8000/sql-wasm.wasm (with both slashes, not one). 🤷

EDIT: using sql.js version 1.7.0 fixed this for me. Also, staying with node version 18 rather than 16.

@darichey
Copy link

darichey commented Jan 5, 2023

Can confirm this is fixed. Works for me on sql.js 1.8.0 and Node 19.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants