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 459 forks source link

`clear` should not throw if the db hasn't been created yet #1020

Closed szmarczak closed 4 months ago

szmarczak commented 8 months ago

What happened?

WARN  Possible Unhandled Promise Rejection (id: 0):
Error: Failed to delete storage directory.Error Domain=NSCocoaErrorDomain Code=4 "“RCTAsyncLocalStorage” couldn’t be removed." UserInfo={NSUserStringVariant=(
    Remove
), NSFilePath=/var/mobile/Containers/Data/Application/C716D281-73E6-43CC-9951-ACE53CB23C88/Documents/ExponentExperienceData/%40anonymous%2Fapp-d771027f-1b8a-4905-82e8-0b5bef0f00b0/RCTAsyncLocalStorage, NSUnderlyingError=0x2803286c0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

Version

1.19.3

What platforms are you seeing this issue on?

System Information

> npx react-native info
info Fetching system and libraries information...
System:
  OS: Windows 10 10.0.22621
  CPU: "(12) x64 AMD Ryzen 5 5600 6-Core Processor              "
  Memory: 16.06 GB / 31.91 GB
Binaries:
  Node:
    version: 20.2.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn: Not Found
  npm:
    version: 9.7.2
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: Not Found
  Visual Studio:
    - 17.5.33424.131 (Visual Studio Community 2022)
Languages:
  Java:
    version: 11.0.20.1
    path: C:\Program Files\Eclipse Adoptium\jdk-11.0.20.101-hotspot\bin\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.5
    wanted: 0.72.5
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found

Steps to Reproduce

useEffect(() => {
    (async () => {
        await AsyncStorage.clear();
    })();
}, []);
github-actions[bot] commented 6 months ago

This issue has been marked as stale due to inactivity. Please respond or otherwise resolve the issue within 7 days or it will be closed.

hieucd04 commented 6 months ago

Running into this issue today.

From this SO post, it looks like this issue has been around for about 6 years.

AsyncStorageBot commented 4 months ago

:tada: This issue has been resolved in version 1.22.2 :tada:

The release is available on:

Your semantic-release bot :package::rocket: