aws-mobile-appsync-sdk-js icon indicating copy to clipboard operation
aws-mobile-appsync-sdk-js copied to clipboard

Upgrade @react-native-community/async-storage to react native async storage

Open mdebo opened this issue 4 years ago • 5 comments

@react-native-community/async-storage is deprecated and has moved to react-native-async-storage/async-storage It's a dependency frameworks such as expo. Therefore i'm stuck and cannot upgrade to expo 41

mdebo avatar Jul 12 '21 15:07 mdebo

Any news about this?

mdebo avatar Aug 10 '21 10:08 mdebo

This includes a dependency on @redux-offline/[email protected] which also uses @react-native-async-storage/async-storage fixed here https://github.com/redux-offline/redux-offline/releases/tag/2.6.0-native.1

noo-bass avatar Aug 20 '21 14:08 noo-bass

You can try adding

  "resolutions": {
    "aws-appsync/@react-native-community/async-storage": "npm:@react-native-async-storage/async-storage@^1.15.6",
    "aws-appsync/@redux-offline": "npm:@redux-offline/[email protected]"
  }

to your package.json then rm -rf node_modules/ and yarn install, this essentially replaces the dependencies with their valid versions https://classic.yarnpkg.com/en/docs/selective-version-resolutions/

noo-bass avatar Aug 20 '21 16:08 noo-bass

@manueliglesias can any maintainer please look into this?

aws-appsync dependency uses "@react-native-community/async-storage": "^1.11.0" while @aws-amplify/core dependency uses @react-native-async-storage/async-storage

Getting the following error since I am forced to use @react-native-community/async-storage because of aws-appsync

error: Error: Unable to resolve module @react-native-async-storage/async-storage from .../node_modules/@aws-amplify/core/lib-esm/RNComponents/reactnative.js: @react-native-async-storage/async-storage could not be found within the project or in these directories:
  node_modules

Using both versions in project seems to fail in runtime.

andidev avatar Sep 06 '21 12:09 andidev

You can try adding

  "resolutions": {
    "aws-appsync/@react-native-community/async-storage": "npm:@react-native-async-storage/async-storage@^1.15.6",
    "aws-appsync/@redux-offline": "npm:@redux-offline/[email protected]"
  }

to your package.json then rm -rf node_modules/ and yarn install, this essentially replaces the dependencies with their valid versions https://classic.yarnpkg.com/en/docs/selective-version-resolutions/

Just want to note that there is a problem with solution. Or at least for me. Importing

  "dependencies": {
    "@react-native-async-storage/async-storage": "^1.15.7",
    "...": "..."
  }

along sides with suggested hack:

  "resolutions": {
    "aws-appsync/@react-native-community/async-storage": "npm:@react-native-async-storage/async-storage@^1.15.7",
    "aws-appsync/@redux-offline": "npm:@redux-offline/[email protected]"
  }

is causing a hidden issue that react-native-async-storage/async-storage@^1.15.7 is bot installed. This is what is written in logs: warning Pattern ["@react-native-async-storage/async-storage@^1.15.7"] is trying to unpack in the same destination "/Users/anders/Library/Caches/Yarn/v6/npm-@react-native-community-async-storage-1.15.7-736ac5cfe211b081e70389e80c237398d1451f08-integrity/node_modules/@react-native-community/async-storage" as pattern ["@react-native-community/async-storage@npm:@react-native-async-storage/async-storage@^1.15.7"]. This could result in non-deterministic behavior, skipping.

It is possible to get pass this by removing the yarn.lock file and running yarn install again but it is way to hacky.

Can some maintainer please address this issue asap? @manueliglesias or @elorzafe Or do I have to go through our paid AWS support to get this critical issue fixed? Or how can I use your services? I really dont understand this.

andidev avatar Sep 14 '21 13:09 andidev