expo: Inconsistent expo-sqlite/next
Minimal reproducible example
https://github.com/abduraufsherkulov/expo-sqlite
What platform(s) does this occur on?
Android
Did you reproduce this issue in a development build?
Yes
Summary
Updated my codebase to use expo-sqlite/next, however it seems API is working inconsistently. Given I do make requests multiple times to SELECT, it is throwing:
[Error: Call to function 'NativeDatabase.prepareAsync' has been rejected.
Caused by: java.lang.NullPointerException: java.lang.NullPointerException]
Video (please bear with me, it stops working only after making requests multiple times): https://github.com/expo/expo/assets/17489128/f9dafaaf-5f5e-4c60-a797-1af8e507c777
Environment
expo-env-info 1.2.0 environment info:
System:
OS: macOS 14.4
Shell: 5.9 - /bin/zsh
Binaries:
Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
Yarn: 1.22.11 - /usr/local/bin/yarn
npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
Watchman: 2024.01.22.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.14.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 23.2, iOS 17.2, macOS 14.2, tvOS 17.2, visionOS 1.0, watchOS 10.2
Android SDK:
API Levels: 23, 28, 29, 30, 31
Build Tools: 28.0.3, 29.0.2, 31.0.0
System Images: android-31 | Google APIs ARM 64 v8a
IDEs:
Android Studio: 2020.3 AI-203.7717.56.2031.7784292
Xcode: 15.2/15C500b - /usr/bin/xcodebuild
npmPackages:
expo: ~50.0.11 => 50.0.11
expo-router: ~3.4.8 => 3.4.8
react: 18.2.0 => 18.2.0
react-native: 0.73.4 => 0.73.4
npmGlobalPackages:
eas-cli: 7.4.0
expo-cli: 6.3.10
Expo Workflow: managed
Expo Doctor Diagnostics
About this issue
- Original URL
- State: closed
- Created 4 months ago
- Comments: 19 (4 by maintainers)
Commits related to this issue
- [sqlite] prevent closing shared database on android (#27748) # Why fixes #27619 close ENG-11740 # How by design, we reuse opened database. however, if there's multiple `openDatabaseAsync` ... — committed to expo/expo by Kudo 3 months ago
- [sqlite] prevent closing shared database on android (#27748) # Why fixes #27619 close ENG-11740 # How by design, we reuse opened database. however, if there's multiple `openDatabaseAsync` and mult... — committed to expo/expo by Kudo 3 months ago
i resolved the issue by my understanding from the https://github.com/abduraufsherkulov/expo-sqlite repro. if the fix doesn’t work with you, i guess it might be a different root cause. please try to recreate a new issue with a repro. that would be super helpful. thanks!
facing similar issue on both platforms (iOS & android), here is sentry event:
FunctionCallException: Calling the 'prepareSync' function has failed (at ExpoModulesCore/SyncFunctionComponent.swift:87) → Caused by: SQLiteErrorException: Error code 1: no such table: products (at ExpoSQLite/SQLiteModuleNext.swift:253)I can confirm that products table exists. I’m doing search in 4 tables at the same time and error likely appears by 5% of our users. @Kudothe issue should be fixed by
expo-sqlite@13.4.0. please let me know whether it works for you.This problem often happens to me as well. I think this is due to two requests running at the same time because the previous one was not completely completed correctly.