Skip to content

[6.2.1] Unable to resolve async-storage #1898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
KazuyaHara opened this issue Jun 21, 2019 · 12 comments
Closed

[6.2.1] Unable to resolve async-storage #1898

KazuyaHara opened this issue Jun 21, 2019 · 12 comments

Comments

@KazuyaHara
Copy link

KazuyaHara commented Jun 21, 2019

Since upgrading to v6.2.1 from 6.2.0, app unable to resolve async-storage correctly. My environment is

  • Firebase SDK version: 6.2.1
  • Expo SDK version: 33.0.6

Maybe it occurred by this commit and I know it was made to correspond to this change.

Starting from RN0.59 AsyncStorage is deprecated from react-native and moved into its own package react-native-async-storage.

It seems like expo-related error that app doesn't return 'MODULE_NOT_FOUND' exception as described in following code but can we have some workaround by firebase side?
https://github.com/firebase/firebase-js-sdk/blob/master/packages/app/index.rn.ts#L34-L36

@google-oss-bot
Copy link
Contributor

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@paarasbhandari
Copy link

I'm having the same problem.
Simulator Screen Shot - iPhone X - 2019-06-21 at 00 20 38

@aiham
Copy link

aiham commented Jun 21, 2019

Would be great to have a workaround for Expo, thanks.

@hsubox76
Copy link
Contributor

This is caused by this recent change: #1879

I think that the problem is that it's only checking for the very specific error code 'MODULE_NOT_FOUND' and perhaps a different error code is being thrown in Expo. Currently working on a fix that will try to require the React Native core bundled AsyncStorage after any error on the first require call.

In the meantime, the quickest fix would be to install @react-native-community/async-storage into your React Native project as it will be required in the future anyway (React Native is deprecating the version bundled with React Native core).

We're also working on getting documentation to reflect this.

@hsubox76
Copy link
Contributor

Sorry, it turns out that workaround won't work. I tried it out in Expo and wasn't able to get it working which turns out to be because Expo currently doesn't allow adding additional native modules without ejecting: react-native-async-storage/async-storage#72

I'm still working on the Firebase code fix to let it correctly fall back to requiring the included AsyncStorage.

@hsubox76
Copy link
Contributor

I'm just going to do a rollback of the change as conditional require statements apparently are not supported in React Native. In the meantime, please use Firebase version 6.2.0. The breaking change was introduced in 6.2.1.

@hsubox76
Copy link
Contributor

Just rolled it back and released Firebase 6.2.2. Working to get release notes up but the package is released.

@ghost
Copy link

ghost commented Jun 25, 2019

Hello @hsubox76, I believe the version [email protected] should have fixed this issue. However, I am facing this problem yet. Do you have any solution for that?

@hsubox76
Copy link
Contributor

hsubox76 commented Jul 1, 2019

I guess the above account was deleted? But has anyone else seen this error recur from [email protected] on?

@hsubox76
Copy link
Contributor

Replying to comment left on PR (#1879):

This error completely broken down my dev environment. I deleted yarn, node_modules, reset metro, clear cache, AND re-created a completely new project. But still, It is showing me the error Unable to resolve module react-native-community/async-storage
How is this even possible? Where is this thing locating the package I deleted??

In order to get the fix you must be using [email protected] or later. I've also found it can be tricky to clear the linked package from the project as once you link it, it's also referenced in a number of native Android/iOS build files, not just the JS files.

I know @leochoo mentioned starting a totally new project, so just wanted to double check the Firebase version in your case? Additionally, are you bringing in any other libraries in addition to Firebase that may depend on that async-storage package?

@google-oss-bot
Copy link
Contributor

Hey @KazuyaHara. We need more information to resolve this issue but there hasn't been an update in 7 days. I'm marking the issue as stale and if there are no new updates in the next 3 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot
Copy link
Contributor

Since there haven't been any recent updates here, I am going to close this issue.

@KazuyaHara if you're still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

@firebase firebase locked and limited conversation to collaborators Dec 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants