react-native-async-storage/async-storage

Using ReactDatabaseSupplier with next storage

dincozdemir opened this issue · 1 comments

What happened?

We have a brownfield application where we access async storage from native android code:

val readableDatabase = ReactDatabaseSupplier.getInstance(this).readableDatabase
val someValue = AsyncLocalStorageUtil.getItemImpl(readableDatabase, "some-key")

We recently enabled next storage, and after the migration we noticed we couldn't access data (We get a NullPointerException on the second line). It seems to be ReactDatabaseSupplier component is still accessing the old storage solution

Version

1.19.3

What platforms are you seeing this issue on?

  • Android
  • iOS
  • macOS
  • Windows
  • web

System Information

System:
  OS: macOS 14.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 145.61 MB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.17.0
    path: ~/.nvm/versions/node/v20.17.0/bin/node
  Yarn:
    version: 3.1.0
    path: ~/.nvm/versions/node/v20.17.0/bin/yarn
  npm:
    version: 9.8.1
    path: ~/Projects/goeuro/app/node_modules/.bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/dinc.oezdemir/.gem/ruby/3.4.1/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.2
      - iOS 18.2
      - macOS 15.2
      - tvOS 18.2
      - visionOS 2.2
      - watchOS 11.2
  Android SDK:
    API Levels:
      - "27"
      - "29"
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
    Build Tools:
      - 30.0.3
      - 31.0.0
      - 32.0.0
      - 33.0.0
      - 34.0.0
    System Images:
      - android-27 | Google APIs ARM 64 v8a
      - android-28 | Google APIs ARM 64 v8a
      - android-29 | Google APIs ARM 64 v8a
      - android-30 | Google APIs ARM 64 v8a
      - android-30 | Google Play ARM 64 v8a
      - android-33 | Google Play ARM 64 v8a
      - android-34 | Google TV ARM 64 v8a
    Android NDK: 22.1.7171670
IDEs:
  Android Studio: 2024.2 AI-242.23726.103.2422.13016713
  Xcode:
    version: 16.2/16C5032a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.5
    path: /usr/bin/javac
  Ruby:
    version: 3.4.1
    path: /Users/dinc.oezdemir/.rubies/ruby-3.4.1/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.6
    wanted: 0.72.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Steps to Reproduce

  • Enable next storage and run the app
  • Save data to AsyncStorage
  • Observe thrown exception