async-storage: The folder “manifest.json” doesn’t exist

Current behavior

I am getting a crash report from Sentry saying:

Failed to write manifest file.Error Domain=NSCocoaErrorDomain Code=4 "The folder “manifest.json” doesn’t exist." UserInfo={NSURL=file:///var/mobile/Containers/Data/Application/A7CD2724-A623-49F8-82A5-9B433D1C697F/Documents/RCTAsyncLocalStorage_V1/manifest.json, NSUserStringVariant=Folder, NSUnderlyingError=0x2822e0ae0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

This crash has the highest frequency in my project. ~1.5k a week.

I think the crash occur at this line.

https://github.com/react-native-community/react-native-async-storage/blob/8d275ad706c27962f71849119bc0f1be811a375e/ios/RNCAsyncStorage.m#L366

PS: I am using AsyncStorage through react-native-storage, but because the crash occur in AsyncStorage I report it here.

PPS: I think it’s weird that the crash log says "The folder “manifest.json” doesn’t exist.", because manifest.json isn’t a folder.

Expected behavior

Shouldn’t crash.

Repro steps

I don’t have a way to reproduce yet, but I will keep investigating this issue on my side, and update this thread if I find a way to reproduce.

Any clue to debug this is welcome.

Environment

  • Async Storage version: Embedded with React Native 0.58.6
  • React-Native version: 0.58.6
  • Platform: iOS 12.1.4
  • Logs/Error that are relevant:
Failed to write manifest file.Error Domain=NSCocoaErrorDomain Code=4 "The folder “manifest.json” doesn’t exist." UserInfo={NSURL=file:///var/mobile/Containers/Data/Application/A7CD2724-A623-49F8-82A5-9B433D1C697F/Documents/RCTAsyncLocalStorage_V1/manifest.json, NSUserStringVariant=Folder, NSUnderlyingError=0x2822e0ae0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 8
  • Comments: 22 (6 by maintainers)

Most upvoted comments

@Krizzu Hi, sorry for not mentioning it sooner, but this issue is not resolved.

Please notice that 36e9a12 cannot really fix this issue as it fixes an issue that causing Failed to parse manifest error while this issue is causing Failed to write manifest file.

@StevenMasini mentioned it when opening the issue that the problem probably got to do to this code.

Do you think you can reopen the issue?

This happens in my project every time I clear AsyncStorage in iOS in the React Native Debugger standalone Mac app. The next time I try to write to async storage, the Failed to write manifest error pops up in the console. I have to kill the app in the simulator to get it to work correctly again. It’s difficult to tell if the issue lies with how React Native Debugger clears AsyncStorage or if it’s this package itself. My project only uses AsyncStorage from the RNC, not from RN directly.

clean react-native project react-native - 0.60 react-native-community/async-storage - lastest the issue reproduces itself after cleaning async-storage content in devtools

This happened to me as well. I found out that I had mixed the new and the old AsyncStorage, so in some files I did import AsyncStorage from '@react-native-community/async-storage';, while in others I still had import {AsyncStorage} from "react-native";. Not much of a surprise that this isn’t working. Hope this helps!

If you come against the same issue, please do reopen.

@gluix20 @bell-steven This can be from a situation, where you use the community’s Async Storage and one of your dependency still uses old Async Storage.

Meanwhile, it’d be good to have repro steps so we could look into the issue closely