jepiqueau / jeep-sqlite

Stencil component to create SQLite database and query it in the browser
MIT License
17 stars 9 forks source link

Error: GetVersion: Memory access out of bounds #40

Open gymprogressive opened 1 month ago

gymprogressive commented 1 month ago

Hello, can you tell me how to fix this error?

Error: GetVersion: Memory access out of bounds in _UtilsSQLite.getVersion (utils-sqlite.ts:99:29)

jepiqueau commented 1 month ago

@gymprogressive Can you give a bit more explanation on your context (use of jeep-sqlite in browser alone or with @capacitor-community/sqlite). Can you share your example as i cannot reproduce the error

scope-li commented 2 weeks ago

I have the same problem after upgrading from 2.6.3 to 2.7.2.

I get this in browser with @capacitor-community/sqlite 5.7.4 and douring SQLiteDBConnection.open() in a angular 17 project.

It's the same code, only update the dependencies.

jepiqueau commented 2 weeks ago

@scope-li can you give me a full example so i can test it easily and fix it

scope-li commented 2 weeks ago

@jepiqueau

https://github.com/scope-li/reproducer-jeep-sqlite

Run it with ng serve and you will get the following error in brwoser on page (re)load:

Error: GetVersion: memory access out of bounds
    at _UtilsSQLite.<anonymous> (jeep-sqlite.entry.js:3899:35)
    at Generator.next (<anonymous>)
    at chunk-ATPMZF2Q.js?v=bc2d8fea:59:61
    at new ZoneAwarePromise (zone.js:2662:25)
    at __async (chunk-ATPMZF2Q.js?v=bc2d8fea:43:10)
    at _UtilsSQLite.getVersion (jeep-sqlite.entry.js:3883:33)
    at Database.<anonymous> (jeep-sqlite.entry.js:5577:56)
    at Generator.next (<anonymous>)
    at fulfilled (chunk-ATPMZF2Q.js?v=bc2d8fea:46:24)
    at _ZoneDelegate.invoke (zone.js:365:28)
Yizack commented 2 weeks ago

@scope-li

I just ran your reproduction repo. To fix the issue, simply update the src/assets/sql-wasm.wasm file by replacing it with the version from node_modules/sql.js/dist/sql-wasm.wasm rebuild and that's all!

For every update from this package, always try this solution first.

image

scope-li commented 2 weeks ago

Yes, thats solve the problem. Sorry, I forgot the replace of sql-wasm.wasm. Thanks for your support!

jepiqueau commented 2 weeks ago

@Yizack @scope-li i am travelling, thanks to provide this advice which solves the issue