question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

storage upgrade from 1.2.1 to LEGACY branch doesn't upgrade correctly

See original GitHub issue

Current behavior

when upgrading storage from 1.2.1 to the LEGACY branch, storage from an old directory is not being moved/copied over to the new directory… i believe this is happening because on init when RCTStorageDirectoryMigrate tries to migrate new data to [root]/data/Containers/Data/Application/[app id]/Library/Application Support/[bundle id]/RCTAsyncLocalStorage_V1 the folder doesn’t exist. when i try to run the below code right before the filemanager attempts to copy over the data, migration [NSFileManager copyItemAtPath: toPath: Error:] runs correctly:

    if (!RCTHasCreatedStorageDirectory) {
        NSString *storageDirectoryPath = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES).firstObject;
        storageDirectoryPath = [storageDirectoryPath stringByAppendingPathComponent:[[NSBundle mainBundle] bundleIdentifier]];

      [[NSFileManager defaultManager] createDirectoryAtPath:storageDirectoryPath
                                withIntermediateDirectories:YES
                                                 attributes:nil
                                                      error:&error];
      RCTHasCreatedStorageDirectory = YES;
    }

Screen Shot 2020-02-18 at 6 34 07 PM

Expected behavior

We shouldn’t get the warning and folder migration should happen correctly.

Repro steps

  1. check out this repo: https://github.com/frankenthumbs/AsyncStorageUpgradePOC
  2. run yarn on root
  3. run pod install on /ios folder
  4. run ios application
  5. tap set storage to 'I Like to Save It' to save a string to async storage
  6. in package json, upgrade @react-native-community/async-storage to git://github.com/react-native-community/async-storage.git#4e49db6308882515a284a183c8e9daf5a50b33ef
  7. in change lines
pod 'react-native-async-storage', :path => '../node_modules/@react-native-community/async-storage'

to

pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'
  1. run yarn and pod install described in step 2 and 3
  2. run application and notice that async-storage is null (where it should be set to saved string) and we get aforementioned warning.

Environment

  • Async Storage version: commit: 4e49db6308882515a284a183c8e9daf5a50b33ef
  • React-Native version: 0.61.5
  • Platform tested: iOS
  • Logs/Error that are relevant: 2020-02-18 17:00:13.828 [warn][tid:com.facebook.react.JavaScript][RNCAsyncStorage.m:205] Failed to copy old storage directory to new storage directory location during migration: Error Domain=NSCocoaErrorDomain Code=4 "The file “RCTAsyncLocalStorage_V1” doesn’t exist." UserInfo={NSSourceFilePathErrorKey=/Users/joon.son/Library/Developer/CoreSimulator/Devices/A9A28D7F-CDD1-49EC-9138-356C0A9A7C4C/data/Containers/Data/Application/B8CAFA4D-89A5-4EE5-92F0-78B4406870D3/Documents/RCTAsyncLocalStorage_V1, NSUserStringVariant=( Copy ), NSDestinationFilePath=/Users/joon.son/Library/Developer/CoreSimulator/Devices/A9A28D7F-CDD1-49EC-9138-356C0A9A7C4C/data/Containers/Data/Application/B8CAFA4D-89A5-4EE5-92F0-78B4406870D3/Library/Application Support/com.nfl.mobile3/RCTAsyncLocalStorage_V1, NSFilePath=/Users/joon.son/Library/Developer/CoreSimulator/Devices/A9A28D7F-CDD1-49EC-9138-356C0A9A7C4C/data/Containers/Data/Application/B8CAFA4D-89A5-4EE5-92F0-78B4406870D3/Documents/RCTAsyncLocalStorage_V1, NSUnderlyingError=0x60000159a3a0 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
frankenthumbscommented, Feb 20, 2020

i put up a PR here. https://github.com/react-native-community/async-storage/pull/303 definitely not my finest work… would love feedback on it if possible.

1reaction
tranhoangduong1994commented, Feb 24, 2020

I experienced the same issue when migrate from 1.6.2 to 1.8.0. For now, using 1.7.1 is my workaround.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bug listing with status RESOLVED with resolution FIXED as at ...
... Bug:393 - "portage handles 'emerge --world update' incorrectly; pkg_* functions do not work properly" status:RESOLVED resolution:FIXED severity:normal ...
Read more >
Release Notes for Cisco UCS Manager, Release 1.2(1) - Cisco
To update the Cisco UCS software and firmware, refer to the following documents: • For upgrading from release 1.1(1) to 1.2(1) refer to....
Read more >
Upgrading Ruby on Rails
Upgrading Ruby on RailsThis guide provides steps to be followed when you upgrade your applications to a newer version of Ruby on Rails....
Read more >
BIG-IP 16.1.2.1 Fixes and Known Issues - AskF5 - F5 Networks
Note: This workaround does not survive upgrade. It must be reapplied after every upgrade until the upgraded version contains a fix. Fix: This...
Read more >
ingress-nginx/Changelog.md at main - GitHub
Upgrade NGINX to 1.21.6; Upgrade Golang 1.19.2; Fix Service Name length Bug ... of Kubernetes v1.25 we are dropping support for the legacy...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found