Skip to content
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

Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.----- react-native #2923

Closed
AntonisMalakas opened this issue Apr 16, 2020 · 90 comments · Fixed by #3101

Comments

@AntonisMalakas
Copy link

@firebase/firestore: Firestore (7.13.2): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.

ive been getting this error working on react-native.
firebase connects normally, with auth()
and it gets data from firebase realtime database,
but i cant seem to get it working for firestore.

@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.
@AntonisMalakas AntonisMalakas changed the title Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds. Apr 16, 2020
@sanket1703
Copy link

I am facing the same problem

@AntonisMalakas
Copy link
Author

I am facing the same problem

i have given up trying with this, i switched to react-native-firebase. if you are willing to switch and find any kind of problems while including the library in your project, feel free to contact me

@schmidt-sebastian
Copy link
Contributor

@anthony-elhaddad @sanket1703 Sorry that we missed this issue.

If you still have the original set up, do you mind sharing your connection logs? You can enable detailed debug logging using firebase.firestore.setLogLevel('debug'). Thank you.

@sanket1703
Copy link

[2020-04-22T05:53:08.814Z] @firebase/firestore: Firestore (7.14.1): FirestoreClient Initializing. user= KExOo6RynESPKWF3vetxh8qbjaE3
[Wed Apr 22 2020 11:23:11.441] LOG [2020-04-22T05:53:08.944Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Synchronize last document change read time
[Wed Apr 22 2020 11:23:11.445] LOG [2020-04-22T05:53:08.950Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Get last stream token
[Wed Apr 22 2020 11:23:11.454] LOG [2020-04-22T05:53:08.953Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Get next mutation batch
[Wed Apr 22 2020 11:23:11.457] LOG [2020-04-22T05:53:08.958Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Locally write mutations
[Wed Apr 22 2020 11:23:11.466] LOG [2020-04-22T05:53:08.968Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: notifyLocalViewChanges
[Wed Apr 22 2020 11:23:11.469] LOG [2020-04-22T05:53:08.971Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Get next mutation batch
[Wed Apr 22 2020 11:23:11.470] LOG [2020-04-22T05:53:08.973Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Get next mutation batch
[Wed Apr 22 2020 11:23:11.473] LOG [2020-04-22T05:53:08.979Z] @firebase/firestore: Firestore (7.14.1): Connection Creating WebChannel: https://firestore.googleapis.com/google.firestore.v1.Firestore/Write/channel [object Object]
[Wed Apr 22 2020 11:23:11.481] LOG [2020-04-22T05:53:08.986Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Allocate target
[Wed Apr 22 2020 11:23:11.486] LOG [2020-04-22T05:53:08.992Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Execute query
[Wed Apr 22 2020 11:23:11.498] LOG [2020-04-22T05:53:08.996Z] @firebase/firestore: Firestore (7.14.1): IndexFreeQueryEngine Using full collection scan to execute query: %s Query(target=Target(Medicines/p6mdUUaFWavz3obrTlIc, orderBy: [name (asc)]); limitType=F)
[Wed Apr 22 2020 11:23:11.502] LOG [2020-04-22T05:53:09.005Z] @firebase/firestore: Firestore (7.14.1): Connection Creating WebChannel: https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel [object Object]
[Wed Apr 22 2020 11:23:11.516] LOG [2020-04-22T05:53:09.013Z] @firebase/firestore: Firestore (7.14.1): Connection Opening WebChannel transport.
[Wed Apr 22 2020 11:23:11.517] LOG [2020-04-22T05:53:09.020Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel sending: {"database":"projects/tra1-bfac8/databases/(default)"}
[Wed Apr 22 2020 11:23:11.540] LOG [2020-04-22T05:53:09.043Z] @firebase/firestore: Firestore (7.14.1): Connection Opening WebChannel transport.
[Wed Apr 22 2020 11:23:11.543] LOG [2020-04-22T05:53:09.045Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel sending: {"database":"projects/tra1-bfac8/databases/(default)","addTarget":{"documents":{"documents":["projects/tra1-bfac8/databases/(default)/documents/Medicines/p6mdUUaFWavz3obrTlIc"]},"targetId":2}}
[Wed Apr 22 2020 11:23:11.834] LOG [2020-04-22T05:53:09.329Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel transport opened.
[Wed Apr 22 2020 11:23:11.849] LOG [2020-04-22T05:53:09.350Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel transport opened.
[Wed Apr 22 2020 11:23:21.597] LOG Server data: undefined

@sanket1703
Copy link

Please do update me on this ASAP. I have finished my project and this issue is stopping me from deployment.

@schmidt-sebastian
Copy link
Contributor

@sanket1703 Thanks for these logs. Unfortunately, these only show the connection attempt, but not any responses. This could be expected if your device did not receive any data, but it makes it hard for us to debug.

One thing that you could try is to enable experimentalForceLongPolling, which switches our client to a different networking model. You can enable it as such:

firebase.firestore().settings({ experimentalForceLongPolling: true });

If that does not help, we probably need a small repro app that we can run locally to continue this investigation.

@AntonisMalakas
Copy link
Author

AntonisMalakas commented Apr 25, 2020

@schmidt-sebastian @sanket1703 ill be able to make a small repo with the current problem as soon as im done with work. Hopefully to find the problem by the end of the debugging session.

Please take a look at this link https://firebase.google.com/docs/firestore/library-integrations provided by firebase.

React Native Firebase
Platforms: Android, iOS
React Native Firebase is the officially recommended React Native library for Firebase. However, it is not covered by Firebase support. Learn more about what you can do with React Native and Cloud Firestore in Getting started with Cloud Firestore on React Native.

@sanket1703 if your app is ready for deployment, you can always integrate React Native Firebase.
this repo i did explaning the integration of react-native-firebase
https://github.com/anthony-elhaddad/ReactNativeVectorFirebaseStarterKit
Please contact me for any questions.

Thanks

@sanket1703
Copy link

@anthony-elhaddad Sure Ill try react native firebase till then. Thank you.

@olriko
Copy link

olriko commented May 6, 2020

same issue on ssr nuxt vuejs.

@khmy2010
Copy link

khmy2010 commented May 8, 2020

same with Angular Fire despite having strong network connection (LAN) that can easily stream YouTube.

@schmidt-sebastian
Copy link
Contributor

If these issues persist, please provide debug logs for Firestore with and without experimentalForceLongPolling. This will give us some insight into the network traffic.

@khmy2010
Copy link

khmy2010 commented May 8, 2020

[2020-05-08T23:32:59.005Z] @firebase/firestore: Firestore (7.14.1): FirestoreClient Initializing. user= fEeMIXHBSyfqqGfOiUWlaztOl0H2
index.esm.js:106 [2020-05-08T23:32:59.030Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Get last stream token
index.esm.js:106 [2020-05-08T23:32:59.033Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Get next mutation batch
index.esm.js:106 [2020-05-08T23:32:59.047Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Allocate target
index.esm.js:106 [2020-05-08T23:32:59.051Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Execute query
index.esm.js:106 [2020-05-08T23:32:59.053Z] @firebase/firestore: Firestore (7.14.1): IndexFreeQueryEngine Using full collection scan to execute query: %s Query(target=Target(categories, filters: [uid == fEeMIXHBSyfqqGfOiUWlaztOl0H2], orderBy: [createdDate (desc), name (desc)]); limitType=F)
index.esm.js:106 [2020-05-08T23:32:59.060Z] @firebase/firestore: Firestore (7.14.1): Connection Creating WebChannel: https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel [object Object]
index.esm.js:106 [2020-05-08T23:32:59.085Z] @firebase/firestore: Firestore (7.14.1): Connection Opening WebChannel transport.

[2020-05-08T23:32:59.088Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel sending: {"database":"projects/(project name has been hidden by author)/databases/(default)","addTarget":{"query":{"structuredQuery":{"from":[{"collectionId":"categories"}],"where":{"fieldFilter":{"field":{"fieldPath":"uid"},"op":"EQUAL","value":{"stringValue":"fEeMIXHBSyfqqGfOiUWlaztOl0H2"}}},"orderBy":[{"field":{"fieldPath":"createdDate"},"direction":"DESCENDING"},{"field":{"fieldPath":"name"},"direction":"DESCENDING"}]},"parent":"projects/(project name has been hidden by author)/databases/(default)/documents"},"targetId":2}}

index.esm.js:106 [2020-05-08T23:32:59.743Z] @firebase/firestore: Firestore (7.14.1): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
defaultLogHandler @ index.esm.js:106
push../node_modules/@firebase/logger/dist/index.esm.js.Logger.error @ index.esm.js:216
ge @ index.cjs.js:4102
t.U_ @ index.cjs.js:10427
(anonymous) @ index.cjs.js:10396
(anonymous) @ index.cjs.js:4956
(anonymous) @ index.cjs.js:5099
invoke @ zone-evergreen.js:364
run @ zone-evergreen.js:123
(anonymous) @ zone-evergreen.js:857
invokeTask @ zone-evergreen.js:399
runTask @ zone-evergreen.js:167
drainMicroTaskQueue @ zone-evergreen.js:569
invokeTask @ zone-evergreen.js:484
invokeTask @ zone-evergreen.js:1621
globalZoneAwareCallback @ zone-evergreen.js:1647
index.esm.js:106 [2020-05-08T23:32:59.768Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel transport opened.
index.esm.js:106 [2020-05-08T23:32:59.854Z] @firebase/firestore: Firestore (7.14.1): MemoryPersistence Starting transaction: Release target
index.esm.js:106 [2020-05-08T23:32:59.856Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel sending: {"database":"projects/(project name has been hidden by author)/databases/(default)","removeTarget":2}
index.esm.js:106 [2020-05-08T23:33:00.286Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel received: {"targetChange":{"targetChangeType":"ADD","targetIds":[2]}}
index.esm.js:106 [2020-05-08T23:33:00.379Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel received: {"targetChange":{"targetChangeType":"REMOVE","targetIds":[2]}}
index.esm.js:106 [2020-05-08T23:33:02.855Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel transport closed
index.esm.js:106 [2020-05-08T23:33:02.862Z] @firebase/firestore: Firestore (7.14.1): PersistentStream stream callback skipped by getCloseGuardedDispatcher.

I am using AngularFire as well.

@schmidt-sebastian
Copy link
Contributor

@khmy2010 Thank you for providing the logs. I have to do some more research here. What is interesting that we are able to establish a connection quite quickly:

[2020-05-08T23:32:59.085Z] @firebase/firestore: Firestore (7.14.1): Connection Opening WebChannel transport.
[2020-05-08T23:32:59.088Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel sending: ...
[2020-05-08T23:32:59.743Z] @firebase/firestore: Firestore (7.14.1): Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds.
[2020-05-08T23:32:59.768Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel transport opened.
[2020-05-08T23:32:59.856Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel sending: {"database":"projects/(project name has been hidden by author)/databases/(default)","removeTarget":2}
[2020-05-08T23:33:00.286Z] @firebase/firestore: Firestore (7.14.1): Connection WebChannel received: {"targetChange":{"targetChangeType":"ADD","targetIds":[2]}}

This log segment shows a successful connection within less than one second. Something must be off with our timer.

@luisfelipesd
Copy link

image

its happening actually in the firestore interfaces, it loads on my cellphone. and it was working on my laptop, it just stopped working all of a sudden.

@mukulseth
Copy link

Bump.. Having the same issue from my ReactJS app, and the Firebase Console as well.. glad to see I'm not the only one. Is there something I can do to fix this as it's holding my development up? Or is there a bigger problem here?

image

its happening actually in the firestore interfaces, it loads on my cellphone. and it was working on my laptop, it just stopped working all of a sudden.

@kamami
Copy link

kamami commented May 15, 2020

Facing same issue!

@Temkit
Copy link

Temkit commented May 15, 2020

Facing same issue,

When reading from Firestore just after Signin :

Signin with Google -> reading from firestore (the same issue as below)
Signin with email password -> reading from firestore (working as expected)

....

@sjmedie
Copy link

sjmedie commented May 15, 2020

Same issues.

@MichaelFrieze
Copy link

MichaelFrieze commented May 16, 2020

I am also having this issue. My project is just a simple Create React App. If I refresh the page then I am connected and the error goes away.

@MichaelFrieze
Copy link

So I checked out one of my older commits and it works fine. This is what caused the error:

image

@vivek781113
Copy link

Facing same issue. I have created simple application with JavaScript and html in order to explore firestore.
Error,jpg
code

@vandres
Copy link

vandres commented Jun 4, 2020

Ah, sorry for the misleading expression. I am having it, when my app makes a request very soon after initializing. Firefox for example can handel it most of the time. Safari shows that errror on every startup.

@schmidt-sebastian
Copy link
Contributor

@vandres Can you share your logs?

@vandres
Copy link

vandres commented Jun 4, 2020

Don't know why is says "7.14.5", I've installed 7.14.6

[Log] [2020-06-04T17:00:57.445Z]  @firebase/firestore: – "Firestore (7.14.5): FirestoreClient" – "Initializing. user=" – "null" (vendor.js, line 179863)
[Log] [2020-06-04T17:00:57.451Z]  @firebase/firestore: – "Firestore (7.14.5): MemoryPersistence" – "Starting transaction:" – "Get last stream token" (vendor.js, line 179863)
[Log] [2020-06-04T17:00:57.452Z]  @firebase/firestore: – "Firestore (7.14.5): MemoryPersistence" – "Starting transaction:" – "Get next mutation batch" (vendor.js, line 179863)
[Log] [2020-06-04T17:00:57.454Z]  @firebase/firestore: – "Firestore (7.14.5): MemoryPersistence" – "Starting transaction:" – "Allocate target" (vendor.js, line 179863)
[Log] [2020-06-04T17:00:57.455Z]  @firebase/firestore: – "Firestore (7.14.5): MemoryPersistence" – "Starting transaction:" – "Execute query" (vendor.js, line 179863)
[Log] [2020-06-04T17:00:57.456Z]  @firebase/firestore: – "Firestore (7.14.5): IndexFreeQueryEngine" – "Using full collection scan to execute query:" – "Query(target=Target(indices/communities, orderBy: [__name__ (asc)]); limitType=F)" (vendor.js, line 179863)
[Log] [2020-06-04T17:00:57.554Z]  @firebase/firestore: – "Firestore (7.14.5): PersistentStream" – "close with error: FirebaseError: [code=unknown]: Fetching auth token failed: getToken aborted due to token change." (vendor.js, line 179863)
[Error] [2020-06-04T17:00:57.555Z]  @firebase/firestore: – "Firestore (7.14.5): Could not reach Cloud Firestore backend. Connection failed 1 times. Most recent error: FirebaseError: [code=unknown]…"
	(anonyme Funktion) (vendor.js:179863)
	defaultLogHandler (vendor.js:145831)
	(anonyme Funktion) (vendor.js:145941)
	ye (vendor.js:134075)
	(anonyme Funktion) (vendor.js:140455)
	(anonyme Funktion) (vendor.js:140436)
	(anonyme Funktion) (vendor.js:140695)
	step (vendor.js:147803)
	(anonyme Funktion) (vendor.js:147777)
	ZoneAwarePromise (polyfills.js:1156)
	__awaiter (vendor.js:147773)
	(anonyme Funktion)
	(anonyme Funktion) (vendor.js:140018)
	step (vendor.js:147803)
	(anonyme Funktion) (vendor.js:147777)
	ZoneAwarePromise (polyfills.js:1156)
	__awaiter (vendor.js:147773)
	(anonyme Funktion) (vendor.js:138024)
	run (polyfills.js:319)
	(anonyme Funktion) (polyfills.js:1053)
	runTask (polyfills.js:363)
	drainMicroTaskQueue (polyfills.js:765)
	invokeTask (polyfills.js:680)
	invokeTask (polyfills.js:1817)
	globalZoneAwareCallback (polyfills.js:1843)
[Log] [2020-06-04T17:00:57.557Z]  @firebase/firestore: – "Firestore (7.14.5): FirestoreClient" – "Credential Changed. Current user: null" (vendor.js, line 179863)
[Log] [2020-06-04T17:00:57.557Z]  @firebase/firestore: – "Firestore (7.14.5): RemoteStore" – "RemoteStore restarting streams for new credential" (vendor.js, line 179863)
[Log] [2020-06-04T17:00:57.558Z]  @firebase/firestore: – "Firestore (7.14.5): MemoryPersistence" – "Starting transaction:" – "Get last stream token" (vendor.js, line 179863)
[Log] [2020-06-04T17:00:57.558Z]  @firebase/firestore: – "Firestore (7.14.5): MemoryPersistence" – "Starting transaction:" – "Get next mutation batch" (vendor.js, line 179863)
[Log] [2020-06-04T17:00:57.559Z]  @firebase/firestore: – "Firestore (7.14.5): Connection" – "Creating WebChannel: https://firestore.googleapis.com/google.firestore.v1.Firestore/Listen/channel [object Object]" (vendor.js, line 179863)
[Log] [2020-06-04T17:00:57.705Z]  @firebase/firestore: – "Firestore (7.14.5): Connection" – "Opening WebChannel transport." (vendor.js, line 179863)
@d5u
Copy link

d5u commented Jun 5, 2020

still seeing this error on version 7.15.0

@romshiri
Copy link

romshiri commented Jun 7, 2020

Having the same issue. It happens right after Google Sign In. Works otherwise.

@TommyLeong
Copy link

@d5u, @romshiri .. if you are working on React Native platform. Switch to RNFirebase as your dependency. It works fine there. I have just done the switch 1 mins ago, tested everything is working fine.

"@react-native-firebase/app": "^7.2.0",
    "@react-native-firebase/auth": "^8.0.4",
    "@react-native-firebase/firestore": "^7.1.5",
@schmidt-sebastian
Copy link
Contributor

@vandres I think I might have an idea of how to solve the problem you are hitting (#3184)

@RalucaPenciuc
Copy link

Having the same issue and none of the workarounds above made a difference. Seeing that is a firestore issue would it be an option to switch to realtime database?

@edi
Copy link

edi commented Jun 8, 2020

@RalucaPenciuc Are you sure you upgraded to 7.14.6 or 7.15.0 ? I've had this issue before as well, downgraded to 7.14.1 (until 7.14.6 was released), now upgraded to the latest, and I'm all good.

Regards

@vandres
Copy link

vandres commented Jun 8, 2020

@schmidt-sebastian I found a workaround for my problem. I wait with all my requests for an onAuthChange, even if the user is null. But I hope they will accept your PR, because this workaround is a little annoying.

@RalucaPenciuc
Copy link

@RalucaPenciuc Are you sure you upgraded to 7.14.6 or 7.15.0 ? I've had this issue before as well, downgraded to 7.14.1 (until 7.14.6 was released), now upgraded to the latest, and I'm all good.

Regards

It's all good now even though I did nothing in particular. I downgraded to 7.14.1 and eventually deleted the { experimentalForceLongPolling: true } line. It remained just a small error about a corrupt entry in my db and that's all. Super weird.

@yzalvov
Copy link

yzalvov commented Jun 8, 2020

I guess it has something to do with firebase networking. User location in particular (region, country).

For me the problem was temporary, with firestore and firebase.auth. The problem was on a physical android device in Russia.
In the same time from the same location one of my emulated Android device but with DNS proxy set up to 8.8.8.8 (Google DNS) was working fine.

And I see people are complaining from outside of US.

@schmidt-sebastian
Copy link
Contributor

#3184 is merged and should be released this week.

@jasperlanting10
Copy link

jasperlanting10 commented Jun 9, 2020

It's probably a bug in the most recent version of Firebase (7.14.6), I tried switching to an older version and it worked for me!

  1. Change your Firebase version in your package.json to: "firebase": "7.14.6"

  2. Then add the base-64 package: https://www.npmjs.com/package/base-64

  3. Add this code snippet to your App.js:
    import {decode, encode} from 'base-64';
    if (!global.btoa) {
    global.btoa = encode;
    }
    if (!global.atob) {
    global.atob = decode;
    }

  4. Run npm install in your root folder of your project

  5. Try again and it should work!

@johannbotha
Copy link

The temp solution worked for me

firebase.firestore().settings({ experimentalForceLongPolling: true });

on firebase@7.15.0

@ghost
Copy link

ghost commented Jun 11, 2020

In my case, I was able to set persistence to none and that fixed the issue:

firebase_app
    .signInWithCustomToken(custom_token)
    .then(() => {
        firebase_app.setPersistence(
            firebase.auth.Auth.Persistence.NONE
        )
    })

https://firebase.google.com/docs/auth/web/auth-state-persistence

@wceolin
Copy link

wceolin commented Jun 13, 2020

Just confirming that #3184 (released on v7.15.1) fixed this issue for me.

@kabeza
Copy link

kabeza commented Jun 16, 2020

Hi guys
I've tried manually downgrading to 7.14.6 by ediging package.json file
Then erased package-lock and node_modules folder, did npm install, etc. w/o luck

Tried @TommyLeong suggestion
replaced firebase line in package.json, with these
"@react-native-firebase/app": "^7.2.0",
"@react-native-firebase/auth": "^8.0.4",
"@react-native-firebase/firestore": "^7.1.5",
and now npx react-native run-android does not even build

Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
Task :app:mergeDexDebug FAILED

Is there any chance I can force to install 7.15.1 as @wceolin ?

Because when error shows, it always show firebase/firestore 7.15.0

Thakns

@nwaughachukwuma
Copy link

Just confirming that #3184 (released on v7.15.1) fixed this issue for me.

@wceolin @schmidt-sebastian the issue is fixed for me, but there's an issue on Safari where the App does not hydrate quick enough. Sometimes I have to close the current tab and open another one to get my Firestore data. The same thing happens on iOS (Safari)

@TommyLeong
Copy link

Hi guys
I've tried manually downgrading to 7.14.6 by ediging package.json file
Then erased package-lock and node_modules folder, did npm install, etc. w/o luck

Tried @TommyLeong suggestion
replaced firebase line in package.json, with these
"@react-native-firebase/app": "^7.2.0",
"@react-native-firebase/auth": "^8.0.4",
"@react-native-firebase/firestore": "^7.1.5",
and now npx react-native run-android does not even build

Task :app:stripDebugDebugSymbols UP-TO-DATE
Compatible side by side NDK version was not found.
Task :app:mergeDexDebug FAILED

Is there any chance I can force to install 7.15.1 as @wceolin ?

Because when error shows, it always show firebase/firestore 7.15.0

Thakns

Did you reinstall your node_module after replacing the pacakge.json?

@vaduinc
Copy link

vaduinc commented Jun 17, 2020

I followed something similar to jasperlanting10 and finally it worked for me.
I'm using firebase 7.15.1

First set the "experimentalForceLongPolling: true

...
export const db = firebase.firestore();
db.settings({experimentalForceLongPolling: true});
...

Then in my index.js I setup a global.atob and global.btoa

Something like this;

global.atob = function atob(input) {
    var keyStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
    var output = ''
    var chr1, chr2, chr3
    var enc1, enc2, enc3, enc4
    var i = 0
    input = input.replace(/[^A-Za-z0-9\+\/\=]/g, '')
    do {
        enc1 = keyStr.indexOf(input.charAt(i++))
        enc2 = keyStr.indexOf(input.charAt(i++))
        enc3 = keyStr.indexOf(input.charAt(i++))
        enc4 = keyStr.indexOf(input.charAt(i++))
        chr1 = (enc1 << 2) | (enc2 >> 4)
        chr2 = ((enc2 & 15) << 4) | (enc3 >> 2)
        chr3 = ((enc3 & 3) << 6) | enc4
        output = output + String.fromCharCode(chr1)
        if (enc3 !== 64) {
            output = output + String.fromCharCode(chr2)
        }
        if (enc4 !== 64) {
            output = output + String.fromCharCode(chr3)
        }
    } while (i < input.length)
    return output
}

global.btoa = function btoa (input) {
    chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
    let str = input;
    let output = "";

    for (let block = 0, charCode, i = 0, map = chars;
    str.charAt(i | 0) || (map = '=', i % 1);
    output += map.charAt(63 & block >> 8 - i % 1 * 8)) {

      charCode = str.charCodeAt(i += 3/4);

      if (charCode > 0xFF) {
        throw new Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");
      }

      block = block << 8 | charCode;
    }

    return output;
  }

@kabeza
Copy link

kabeza commented Jun 17, 2020

Did you reinstall your node_module after replacing the pacakge.json?

Yea, of course @TommyLeong

@Matgsan
Copy link

Matgsan commented Jun 19, 2020

Same problem @kabeza have u solved?

@kabeza
Copy link

kabeza commented Jun 19, 2020

Same problem @kabeza have u solved?

Nope.

  1. Tried downgrading to 7.14.6, no luck (I've edited package.json, deleted node_modules folder and then reinstalled all again with npm install). I recompiled and still got the error regarding firebase/firestore 7.15.0. Maybe I downgraded incorrectly
    https://i.imgur.com/BYclBwJ.jpg

  2. Tried replacing with NeactNative Firebase, no luck (but this is far more complex than editing package.json and reinstalling. It involves more tasks)

I guess I'll have to go with axios and rest api instead

@Matgsan
Copy link

Matgsan commented Jun 23, 2020

@kabeza I have been able to solve with react-native-firebase. Completely uninstall the app, like, remove it from the home screen, delete it completly and then try to install it again. Solved for me.

@kabeza
Copy link

kabeza commented Jun 23, 2020

@kabeza I have been able to solve with react-native-firebase. Completely uninstall the app, like, remove it from the home screen, delete it completly and then try to install it again. Solved for me.

The problem is that when I replace firebase with rnfirebase in package.json, reinstall everything with npm, etc. the app doesn't even build, doesn't compile

https://i.imgur.com/XdBCOu9.jpg

I've replaced this line

"firebase": "^7.15.0",

with these

"@react-native-firebase/app": "^7.2.0",
"@react-native-firebase/auth": "^8.0.4",
"@react-native-firebase/firestore": "^7.1.5",

Don't know if that's the way to do it but I've read it here

@firebase firebase locked and limited conversation to collaborators Jun 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.