react-native-async-storage / async-storage

An asynchronous, persistent, key-value storage system for React Native.
https://react-native-async-storage.github.io/async-storage/
MIT License
4.61k stars 458 forks source link

Error: cannot read property 'persist' of null #1083

Closed stephanepericat closed 2 months ago

stephanepericat commented 2 months ago

What happened?

When a user installs an app with react native async storage, the first time they try to set a value into sqlite, it throws an error: Error: cannot read property 'persist' of null

This only happens the first time; after that, it works as expected. it also does not happen in simulator apps, only on a physical device.

Any idea why?

Version

1.22.3

What platforms are you seeing this issue on?

System Information

System:
  OS: macOS 13.6.6
  CPU: (4) x64 Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz
  Memory: 20.87 MB / 8.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.0
    path: ~/.nvm/versions/node/v18.18.0/bin/node
  Yarn:
    version: 1.22.21
    path: /usr/local/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.18.0/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.14.3
    path: /usr/local/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: Not Found
IDEs:
  Android Studio: 2023.1 AI-231.9392.1.2311.11330709
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/local/opt/openjdk@17/bin/javac
  Ruby:
    version: 3.3.0
    path: /usr/local/opt/ruby/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.6
    wanted: 0.73.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

Steps to Reproduce

  1. create an app where user can store a value in async storage via UI (say a switch or a select)
  2. install the app on a physical device
  3. set item by using the UI element
stephanepericat commented 2 months ago

it turned out to be a Formik issue

krizzu commented 2 months ago

sorry for late response! Yes, it seems like something out of AsyncStorage context, glad u found it