awslabs / aws-mobile-appsync-sdk-js

JavaScript library files for Offline, Sync, Sigv4. includes support for React Native
Apache License 2.0
919 stars 266 forks source link

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

Open mdebo opened 3 years ago

mdebo commented 3 years ago

@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 commented 3 years ago

Any news about this?

noo-bass commented 3 years ago

This includes a dependency on @redux-offline/redux-offline@2.5.2-native.3 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 commented 3 years ago

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/redux-offline@2.6.0-native.1"
  }

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/

andidev commented 2 years ago

@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 commented 2 years ago

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/redux-offline@2.6.0-native.1"
  }

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/redux-offline@2.6.0-native.1"
  }

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.