sqlite icon indicating copy to clipboard operation
sqlite copied to clipboard

feat: update to sql.js 1.13.0

Open p4wn-dev opened this issue 8 months ago • 5 comments

Updating sql.js to 1.13.0 causes errors like "LinkError: WebAssembly.instantiate(): Import https://github.com/sql-js/sql.js/issues/34 "a" "I": function import requires a callable"

Either jeep-sqlite is causing it or the sqlite package itself. Would be great to upgrade the version since sql.js 1.13.0 has many improvements.

p4wn-dev avatar Mar 21 '25 20:03 p4wn-dev

Not sure if this is the issue as jeep-sqlite installs sql.js 1.13.0 as dependency (^1.11.0).

mahnuh avatar Mar 25 '25 05:03 mahnuh

Not sure if this is the issue as jeep-sqlite installs sql.js 1.13.0 as dependency (^1.11.0).

I think it has something to do with how jeep-sqlite is loading the .wasm file. If you look at this issue in sql.js, incompatability between software and .wasm can cause the "I": function import requires a callable" issue.

GM-mmilideo avatar Mar 25 '25 16:03 GM-mmilideo

For me the error went away to lock sql.js to version 1.12.0 in my dependencies.

robkorv avatar Mar 27 '25 14:03 robkorv

For me the error went away to lock sql.js to version 1.12.0 in my dependencies.

Thank you! This wasted me an entire afternoon to hunt down. I should have checked open issues first.

I installed the latest @capacitor-community/sqlite and I kept getting the LinkError bubbled up from wasm. No amount of try catch in javascript land helped. Running the following command

npm ls @capacitor-community/sqlite jeep-sqlite sql.js

yields

└─┬ @capacitor-community/[email protected]
  └─┬ [email protected]
    └── [email protected]

I presume sql.js going from 1.12 to 1.13 introduced a breaking change?

MakersAll8 avatar Apr 21 '25 08:04 MakersAll8

For me the error went away to lock sql.js to version 1.12.0 in my dependencies.

In addition to this, after doing an npm update, I had to copy the sql-wasm.wasm file from the node modules distribution to the public\assets folder.

rtarling avatar Jun 14 '25 11:06 rtarling

For me the error went away to lock sql.js to version 1.12.0 in my dependencies.

In addition to this, after doing an npm update, I had to copy the sql-wasm.wasm file from the node modules distribution to the public\assets folder.

(for others who struggled like me) In addition to these two, also change the locateFile function in the initSqlJs to (file) => "/assets/sql-wasm.wasm".

And thank you all, it now works as it should!

cxivo avatar Jul 05 '25 17:07 cxivo

For me the error went away to lock sql.js to version 1.12.0 in my dependencies.

In addition to this, after doing an npm update, I had to copy the sql-wasm.wasm file from the node modules distribution to the public\assets folder.

(for others who struggled like me) In addition to these two, also change the locateFile function in the initSqlJs to (file) => "/assets/sql-wasm.wasm".

And thank you all, it now works as it should!

@cxivo Where is initSqlJs?

rtarling avatar Sep 05 '25 06:09 rtarling

In file.

\node_modules\sql.js\dist\sql-wasm.js

FerreiraPedroo avatar Sep 20 '25 00:09 FerreiraPedroo

For me the error went away to lock sql.js to version 1.12.0 in my dependencies.

In addition to this, after doing an npm update, I had to copy the sql-wasm.wasm file from the node modules distribution to the public\assets folder.

(for others who struggled like me) In addition to these two, also change the locateFile function in the initSqlJs to (file) => "/assets/sql-wasm.wasm".

And thank you all, it now works as it should!

@cxivo Where is initSqlJs?

Just put "cp node_modules/sql.js/dist/sql-wasm.wasm public/assets/" in your terminal if your project is react/vue

Kawesom avatar Sep 20 '25 02:09 Kawesom