Having trouble with expo-sqlite on eas build apk.

Hi all.
I’m trying to get the expo-sqlite to work on our app.
In expo go it works as expected, but when we build with eas build and updates the playstore app it fails with the following error when i try to read from db:
TypeError: Cannot read property ‘exec’ of undefined.
I have printed the db values to ensure it exists

export const openDatabase = async () => {
  try {
    console.log('openDatabase called');
    const fileStatus = await FileSystem.getInfoAsync(COMPLETE_PATH_TO_DB);
    if (fileStatus.exists) {
      const db = SQLite.openDatabase(DB_NAME);
      if (db) {
        console.log('openDatabase is returning database');
        return db;

Im currently trying to use the db like this:

openDatabase().then(database => {       
  if (database) {                       
    database.transaction(tx => {        
                    ['%' + searchValue + '%', '%' + searchValue + '%'],
                    (_, { rows }) => {

The try/catch i have around the db logic is never called for some reason.

openDatabase called
openDatabase is returning database
exception → TypeError: Cannot read property 'exec' of undefined

Does anyone have an idea of what is missing or wrong in the code?
I’m using expo-sdk 48 and expo-sqlite version 11.1.1

Problem is solved.
For others having simular problem, implementing SQLite requires new build, we did only do EAS update.
Everything now works as it should.

1 Like

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