Sqlite: Expo App crashes in simulator after running db.transaction

I’m having trouble with sqlite and expo. I’m running the latest expo sdk (24) on my high sierra machine with iOS simulator.

My code looks like

const db = SQLite.openDatabase({name: 'data.db'});
console.log(db);

db.transaction((tx) => {
    // Never fired and crashes before
    console.log(tx);
}, (tx, data) => { console.log(data) }, (tx, data) => { console.log(data) });

The db log shows:

WebSQLDatabase {
  "_currentTask": null,
  "_db": SQLiteDatabase {
    "_name": Object {
      "name": "data.db",
    },
  },
  "_running": false,
  "_txnQueue": Queue {
    "length": 0,
  },
  "version": "1.0",
}

But the expo app crashes on my simulator seemingly during the db.transaction call. But no errorCallback is triggered.
I’m not able to debug it further because the simulator system log does not state any further information:

(UIKitApplication:host.exp.Exponent[0xbb30][74084][74437]): Service exited due to signal: Segmentation fault: 11 sent by exc handler[0]

Any ideas on this? I’ve already tried to reset everything but with no luck. Thanks!

hi there! it looks like the example project is out of date, I made an issue to update that. if you change the first line to const db = SQLite.openDatabase('data.db'); then it will work as expected (notice that there is no object in the param, just a string for db name)

I fixed the example project: https://github.com/expo/sqlite-example

@notbrent Many thanks! Now it works :wink:

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.