React-native-firebase: Error: Firestore: The service is currently unavailable. (firestore/unavailable).

Created on 29 Aug 2018  路  40Comments  路  Source: invertase/react-native-firebase

Issue

Environment

  1. Application Target Platform:
    Android

  2. Development Operating System:
    macOs HighSierra

  3. Build Tools:

  4. React Native version:
    0.56.0

  5. React Native Firebase Version:
    4.3.7

  6. Firebase Module:
    Firestore

  7. Are you using typescript?

    no

After a while a get the following error:
Error: Firestore: The service is currently unavailable. (firestore/unavailable).
at createErrorFromErrorData (NativeModules.js:146)
at NativeModules.js:95
at MessageQueue.__invokeCallback (MessageQueue.js:392)
at MessageQueue.js:128
at MessageQueue.__guard (MessageQueue.js:291)
at MessageQueue.invokeCallbackAndReturnFlushedQueue (MessageQueue.js:127)
at t (RNDebuggerWorker.js:1)

Then I have to deinstall and reinstall the app to get the connection again.
I tried the new function
firebase.firestore().enableNetwork()
but it doesn't work.

Any ideas?

Best Qung

Firestore Stale

Most helpful comment

@Salakar We are having this issue in our production apps. Please check this
screenshot 2019-03-08 at 1 48 43 pm

All 40 comments

I encountered this error when I used a new fresh firebase project. Firestore database is also needs to be activated on the firebase console.

I encountered this error when I used a new fresh firebase project. Firestore database is also needs to be activated on the firebase console.

So I have to activate Firebase Database too? It's strange because its not reproducible when the app lost the connection. But suddenly it comes online again. In the most case after I installed the app again or restart the simulator.

Hello 馃憢, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

Hi, I can't solved the issue so I changed to Parse as backend. It works like a charme. Now I just use the Push Server for my App.
Maybe I will try it later again.

Best Qung

Hello 馃憢, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

If you are located in China, FireStore / Google is blocked there.

It'll error out with firestore/unavailable

Hello 馃憢, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

Hum... i face the same problem even I am not located in China

Hello 馃憢, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.

@Salakar We are having this issue in our production apps. Please check this
screenshot 2019-03-08 at 1 48 43 pm

any update for this issues

Same here , it is a problem

Someone Help this happens in some times suddenly (not every time)

image

I've got the same problem in two different applications in production.

One possibility is that it's an error message issue.

when I'm doing .get({source: 'cachce'}) and the firebase SDK will throw

Error Domain=FIRFirestoreErrorDomain Code=14 "Failed to get document from cache. (However, this document may exist on the server. Run again without setting source to FirestoreSourceCache to attempt to retrieve the document " UserInfo={NSLocalizedDescription=Failed to get document from cache. (However, this document may exist on the server. Run again without setting source to FirestoreSourceCache to attempt to retrieve the document }

But code 14 will be translated into FIRFirestoreErrorCodeUnavailable

with error message of

The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff.

which is incorrect in this case.

Any solution here?
It's really blocking production release.

Did you guys figure this one out? Please update if anyone did. Thanks!

I'm also having the same problem :/

I'm facing the same issue on my App in production now and then.

Non-fatal Exception: UnhandledPromiseRejection [firestore/unavailable] The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying with a backoff. <unknown>

Would be great to find a workaround soon.

Have the same bug
[firestore/unavailable] The service is currently unavailable. This is a most likely a transient condition and may be corrected by retrying wit

In my case I have array in document and there are 75 items in array. I reduced array items to 50 and error gone.

I get these errors randomly, if I restart the phone they tend to go away.

Also having this issue. Any updates?

Are there any updates on this issue?

Why would there be updates on a closed issue?

Maybe @mikehardy because it should have never been closed in the first place :)

Like @zhigang1992, I can reproduce this issue when I try to get the data from the cache.
On a new device or by deactivating the persistence:

await firestore().settings({
  persistence: false,
});

@RichardFevrier this issue is so old, I'd recommend opening a new issue with 100% up to date versions (that is firebase-ios-sdk 6.28.1 and firebase-android-sdk BoM 25.6.0 - it's documented on rnfirebase.io how to override) to make sure we're not chasing phantoms.

You can't imagine the number of "I have the exact same problems" we get that are actually the same problem about 1% of the time, so we work with the info we have available, doing our best, and close things when they seem like the original issue is closed. With the dates on these comments so old, definitely go for a new issue with up to date versions, necessary info provided, and a repro App.js if at all possible

I had the same problem. In my case it was the settings on google-services.json that were wrong. Maybe it will help someone.

It's. revelant with _firestore.disableNetwork()

When you disable network then enable again; it does not work. It keeps disabled. So that's why getting this error.

And also I could not find any solution.

@emreakcadag there have been several upstream issues related to this, out of our control. If you instrument the code and verify we are calling the native disable/enable network APIs then the react-native-firebase module is doing what it can. You might verify with firebase-android-sdk 25.9.0 and firebase-ios-sdk pod 6.31.0 to make sure that with up to upstream SDKs this is still happening, and check their issues lists (they are on github as well under those repo names)

I had the same issue. It was a problem because the time of the test device was 1 month ago. After correcting the time, all the problems were solved.

Interesting @melodysdreamj that info may help some people. It's important to note that if you are a parent with children, it's currently a "thing to try" for children to get around various parental restrictions by setting the time on their borrowed parent's phones back in time, so having incorrect times/dates set on devices happens more than you would think.

Still have this problem. I tried to change the timezone, signout at the beginning of App.js but no luck :( @mikehardy do you have any idea how to fix it once for good? Thanks

Hello, we have the same problem. Once the device loose it's network and then back it again the firestore keep returning old data. It'a using the cache without synchronizing it until the app is not reinstalled (the local storage is deleted). Please share some workarounds if you have some.

P.S. That's happening on iOS/Android simulator/emulator and devices as well.

The best thing to do is make sure you are using the most up to date firebase-android-sdk underling, which is I think 25.13.0 (26.0.0 won't be possible to use until #4471 lands and forward ports to the new major version of the upstream library). Information on how to override the underlying SDK version (in case you do not have the most current) is on the rnfirebase.io main page I believe

It is still happening on the latest verison.

@aliasad106 does not move the issue forward but does generate notifications for everyone. How did it go when you tried each of detailed items in the comments above?

@mikehardy I'm sorry
This is my environment.

  1. React Native 0.63.3
  2. @react-native-firebase/app" 10.1.0
  3. @react-native-firebase/firestore 10.1.1
  4. Firebase region Europe London
  5. Issue experienced in Pakistan
  6. Happens when network is 2G or slower( everything else works )

So, you have outdated versions (likely not a cause, but still, why chase issues on old versions?) and on likely unreliable networks firestore is unavailable? That seems like expected behavior? There is all sorts of information you do not address about caching, network availability network state etc above.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bitfabrikken picture bitfabrikken  路  52Comments

GH974 picture GH974  路  47Comments

elledienne picture elledienne  路  55Comments

OleksandrKucherenko picture OleksandrKucherenko  路  46Comments

tranty9597 picture tranty9597  路  79Comments