firebase / firebase-js-sdk

Firebase Javascript SDK
https://firebase.google.com/docs/web/setup
Other
4.75k stars 872 forks source link

React Native: Error: @firebase/firestore: ", "Firestore(4.10.1): Could not reach Firestore backend " #638

Closed Luckygirlllll closed 6 years ago

Luckygirlllll commented 6 years ago

[REQUIRED] Describe your environment

Operating System version: IOS (React Native), Android (React Native) Firebase SDK version: 4.12.0 Firebase Product: Firestore

Error: @firebase/firestore: ", "Firestore(4.10.1): Could not reach Firestore backend "

Steps to reproduce:

Add npm install firebase@4.12.0 --save to the react native project Add the code below to the project Nothing is happening (collections and documents were not created)

Relevant Code:

import * as firebase from 'firebase'
import firestore from 'firebase/firestore'

var config = {
  apiKey: "xxxxxxxxxxxxxxxxxx",
  authDomain: "xxxxxxxxxxxxxxxxxx",
  databaseURL: "xxxxxxxxxxxxxxxxxx",
  projectId: "xxxxxxxxxxxxxxxxxx",
  storageBucket: "xxxxxxxxxxxxxxxxxx",
  messagingSenderId: "xxxxxxxxxxxxxxxxxx"
};

firebase.initializeApp(config);

var db = firebase.firestore();

var docRef = db.collection('users').doc('alovelace');

var setAda = docRef.set({
    first: 'Ada',
    last: 'Lovelace',
    born: 1815
})

db.collection("users").get().then((querySnapshot) => {
      querySnapshot.forEach((doc) => {
          console.log(`${doc.id} => ${doc.data()}`)
      })
    })
screen shot 2018-04-05 at 15 50 21
yishin commented 6 years ago

Operating System version: Android (React Native) Firebase SDK version: 4.12.1 Firebase Product: Firestore

I have the same issue, too. but, only error in android.

If this error occurs, the data can not be read. See below error:

Failed to get document because the client is offline.

Luckygirlllll commented 6 years ago

@yishin I can't read and write data both in Android and IOS to Firestore.

arielalvarez88 commented 6 years ago

+1

schmidt-sebastian commented 6 years ago

It would help us isolate this issue if you could provide debug logging. Please take a look here: https://firebase.google.com/docs/reference/js/firebase.firestore.Firestore#setLogLevel

Furthermore, can you tell us when you first saw this behavior? Additionally, can you check and see if you are currently able to access your project from the Firebase Console?

Thanks for your help!

Luckygirlllll commented 6 years ago

@schmidt-sebastian I'm able to access project in Firebase Console. I get this error from the very beginning, so I was testing Firestore, and was not able to write or read data to Firestore. I also have firebase realtime db in the project, it works fine.

Luckygirlllll commented 6 years ago

@schmidt-sebastian Where should I exactly set LogLevel to debug? Inside the react native project? or I should enable it somewhere in console?

schmidt-sebastian commented 6 years ago

@Luckygirlllll You should be able to do so via https://github.com/invertase/react-native-firebase/blob/master/android/src/main/java/io/invertase/firebase/firestore/RNFirebaseFirestore.java#L68

mjsmagalhaes commented 6 years ago

Also having error below from browser (Chrome 65)

@firebase/firestore: Firestore (4.10.1): Could not reach Firestore backend.

The firebase.firestore().setLogLevel('debug') also gives an error:

firestore(...).setLogLevel is not a function

And access from console works fine.

Salakar commented 6 years ago

@schmidt-sebastian appears @Luckygirlllll is using the web SDK inside here not our RNFirebase one - the import of the RN specific one would be import * as firebase from 'react-native-firebase';

Luckygirlllll commented 6 years ago

@Salakar @schmidt-sebastian yes, I’m using web sdk, not react-native-firebase

Luckygirlllll commented 6 years ago

@schmidt-sebastian I'm trying to setLogLevel to "debug", but I'm getting an error, that this function is not defined

screen shot 2018-04-07 at 21 32 25
mikelehen commented 6 years ago

To enable logging it's actually firebase.firestore.setLogLevel('debug') (no parens after firestore).

Also, you may be running into https://github.com/firebase/firebase-js-sdk/issues/283. There was a fix made in react native but I don't think it's been released yet. You can try the workaround in https://github.com/firebase/firebase-js-sdk/issues/283#issuecomment-345884425 and see if that solves the issue for you.

Luckygirlllll commented 6 years ago

@mikelehen I have already tried that solution from the comments of #283, and it didn't help, besides of that I don't have an expo project, I have pure react native, and in my case it doesn't work both in Android and IOS.

@schmidt-sebastian Here are my logs:

[2018-04-08T18:35:53.289Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Start LocalStore
logger.js:67 [2018-04-08T18:35:53.294Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Get last stream token
logger.js:67 [2018-04-08T18:35:53.296Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Get next mutation batch
logger.js:67 [2018-04-08T18:35:53.299Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Locally write mutations
logger.js:67 [2018-04-08T18:35:53.307Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Notify local view changes
logger.js:67 [2018-04-08T18:35:53.309Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Garbage collection
logger.js:67 [2018-04-08T18:35:53.312Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Get next mutation batch
logger.js:67 [2018-04-08T18:35:53.315Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Get next mutation batch
logger.js:67 [2018-04-08T18:35:53.318Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: Creating WebChannel: https://firestore.googleapis.com/google.firestore.v1beta1.Firestore/Write/channel [object Object]
logger.js:67 [2018-04-08T18:35:53.326Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Allocate query
logger.js:67 [2018-04-08T18:35:53.328Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Execute query
logger.js:67 [2018-04-08T18:35:53.332Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Remote document keys
logger.js:67 [2018-04-08T18:35:53.339Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: Creating WebChannel: https://firestore.googleapis.com/google.firestore.v1beta1.Firestore/Listen/channel [object Object]
logger.js:67 [2018-04-08T18:35:53.359Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: Opening WebChannel transport.
logger.js:67 [2018-04-08T18:35:53.389Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel sending: {"database":"projects/xxx/databases/(default)"}
logger.js:67 [2018-04-08T18:35:53.400Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: Opening WebChannel transport.
logger.js:67 [2018-04-08T18:35:53.402Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel sending: {"database":"projects/xxx/databases/(default)","addTarget":{"query":{"structuredQuery":{"from":[{"collectionId":"users"}],"orderBy":[{"field":{"fieldPath":"__name__"},"direction":"ASCENDING"}]},"parent":"projects/xxx/databases/(default)"},"targetId":2}}
[2018-04-08T18:22:12.120Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel transport opened.
logger.js:67 [2018-04-08T18:22:12.132Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel transport opened.
[2018-04-08T18:22:20.642Z]  @firebase/firestore: Firestore (4.10.1) [OnlineStateTracker]: Watch stream didn't reach online or offline within 10000ms. Considering client offline.
[2018-04-08T18:22:20.643Z]  @firebase/firestore: Firestore (4.10.1): Could not reach Firestore backend.
[2018-04-08T18:22:20.658Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Release query
[2018-04-08T18:22:20.665Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel sending: {"database":"projects/xxx/databases/(default)","removeTarget":2}
logger.js:67 [2018-04-08T18:22:20.669Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Garbage collection 
[2018-04-08T18:23:20.676Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel transport closed  
mjsmagalhaes commented 6 years ago

I am using firebase (4.12.1) on a Vue application running on Windows 10 version of Chrome.

With #283 workaround:

18:36:51.257 logger.js?f9f0:65 [2018-04-08T21:36:51.257Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Start LocalStore
18:36:51.466 logger.js?f9f0:65 [2018-04-08T21:36:51.467Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Get last stream token
18:36:51.481 logger.js?f9f0:65 [2018-04-08T21:36:51.482Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Get next mutation batch
18:36:51.484 logger.js?f9f0:65 [2018-04-08T21:36:51.484Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Allocate query
18:36:51.486 logger.js?f9f0:65 [2018-04-08T21:36:51.487Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Execute query
18:36:51.488 logger.js?f9f0:65 [2018-04-08T21:36:51.488Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Remote document keys
18:36:51.494 logger.js?f9f0:65 [2018-04-08T21:36:51.495Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: Creating WebChannel: https://firestore.googleapis.com/google.firestore.v1beta1.Firestore/Listen/channel [object Object]
18:36:51.543 logger.js?f9f0:65 [2018-04-08T21:36:51.544Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: Opening WebChannel transport.
18:36:51.550 logger.js?f9f0:65 [2018-04-08T21:36:51.550Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel sending: {"database":"***","addTarget":{"documents":{"documents":["***"]},"targetId":2}}
18:36:51.743 logger.js?f9f0:65 [2018-04-08T21:36:51.744Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel transport opened.
18:37:01.495 logger.js?f9f0:65 [2018-04-08T21:37:01.495Z]  @firebase/firestore: Firestore (4.10.1) [OnlineStateTracker]: Watch stream didn't reach online or offline within 10000ms. Considering client offline.
18:37:01.502 logger.js?f9f0:77 [2018-04-08T21:37:01.502Z]  @firebase/firestore: Firestore (4.10.1): Could not reach Firestore backend.

(...)

18:37:01.517 logger.js?f9f0:65 [2018-04-08T21:37:01.518Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Release query
18:37:01.522 logger.js?f9f0:65 [2018-04-08T21:37:01.523Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel sending: {"database":"***","removeTarget":2}
18:37:01.527 logger.js?f9f0:65 [2018-04-08T21:37:01.528Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Garbage collection
18:37:01.534 error.js?6b3a:140 Uncaught (in promise) Error: Failed to get document because the client is offline.

(...)

18:37:01.728 logger.js?f9f0:65 [2018-04-08T21:37:01.729Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel received: {"targetChange":{"targetChangeType":"ADD","targetIds":[2]}}
18:37:01.737 logger.js?f9f0:65 [2018-04-08T21:37:01.737Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel received: {"documentChange":{"document":{"createTime":"2018-03-17T13:49:17.638986Z","fields":{"config":{"mapValue":{"fields":{"teste":{"stringValue":"1111"}}}}},"name":"***","updateTime":"2018-04-02T19:56:05.971661Z"},"targetIds":[2]}}
18:37:01.745 logger.js?f9f0:65 [2018-04-08T21:37:01.746Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel received: {"targetChange":{"readTime":"2018-04-08T21:36:50.262970Z","resumeToken":"CgkIuoehstGr2gI=","targetChangeType":"CURRENT","targetIds":[2]}}
18:37:01.753 logger.js?f9f0:65 [2018-04-08T21:37:01.753Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel received: {"targetChange":{"readTime":"2018-04-08T21:36:50.262970Z","resumeToken":"CgkIuoehstGr2gI="}}
18:37:01.758 logger.js?f9f0:65 [2018-04-08T21:37:01.759Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel received: {"targetChange":{"readTime":"2018-04-08T21:36:50.304946Z","resumeToken":"CgkIss+jstGr2gI="}}
18:37:01.763 logger.js?f9f0:65 [2018-04-08T21:37:01.763Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel received: {"targetChange":{"targetChangeType":"REMOVE","targetIds":[2]}}
18:37:01.773 logger.js?f9f0:65 [2018-04-08T21:37:01.774Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Apply remote event
18:37:01.779 logger.js?f9f0:65 [2018-04-08T21:37:01.780Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Notify local view changes
18:37:01.784 logger.js?f9f0:65 [2018-04-08T21:37:01.785Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Garbage collection
18:37:01.787 logger.js?f9f0:65 [2018-04-08T21:37:01.788Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Apply remote event
18:37:01.790 logger.js?f9f0:65 [2018-04-08T21:37:01.790Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Notify local view changes
18:37:01.792 logger.js?f9f0:65 [2018-04-08T21:37:01.792Z]  @firebase/firestore: Firestore (4.10.1) [MemoryPersistence]: Starting transaction: Garbage collection
18:38:01.531 logger.js?f9f0:65 [2018-04-08T21:38:01.532Z]  @firebase/firestore: Firestore (4.10.1) [Connection]: WebChannel transport closed

Looks like it is actually getting data but just after the 10s timer has expired ....

yishin commented 6 years ago

@Luckygirlllll I don't have any time, so I switch to react-native-firebase to fix the problem. Good luck.

terenceponce commented 6 years ago

I came across the same problem as well, but I only get this on Android. It's working as expected on iOS. Is there a solution for this already? I've heard that this problem doesn't exist in react-native-firebase, but using that library would mean that I have to eject out of CRNA/Expo and I would prefer to do that only as a last resort.

mikelehen commented 6 years ago

@Luckygirlllll Hrm. That does sound like a different issue if it's happening on iOS as well. Any chance you can grab the network tab of chrome dev tools when the problem occurs (export as a HAR or something)?

@mjsmagalhaes If you're not using react native, can you please open a separate issue with as much detail you can provide about how you're reproducing the issue?

@terenceponce You're probably hitting https://github.com/firebase/firebase-js-sdk/issues/283. There was a bug in react-native which was fixed with https://github.com/facebook/react-native/commit/d52569c4a1b6bd19792e4bda23e3a8c3ac4ad8df but hasn't made it into a release yet.

In the meantime, you can try adding this before you call any firebase methods to work around the issue:

const originalSend = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send = function(body) {
  if (body === '') {
    originalSend.call(this);
  } else {
    originalSend.call(this, body);
  }
};
terenceponce commented 6 years ago

@mikelehen Thanks for the temporary workaround. I can confirm that this has fixed my problem with Android. I was afraid I was going to have to eject and switch to RNF, but I'm glad that's not going to be the case.

JancoBH commented 6 years ago

I have the same problem, I'm using Angular 5 with angularfire2, since yesterday everything was fine but now I have no idea why im getting the @firebase/firestore: Firestore (4.10.1): Could not reach Firestore backend error

mikelehen commented 6 years ago

Just to be clear, the simplest explanation for that error would be that your device legitimately can't reach the backend for some reason. A simple test for this would be to try to open the Firestore data viewer in the Firebase console from your device / emulator and see if that works.

Luckygirlllll commented 6 years ago

@mikelehen What do you mean by "Firestore data viewer '? You mean this page?

firestore
mikelehen commented 6 years ago

@Luckygirlllll Yes, exactly. Thanks for confirming. Was there any delay in it loading? The logs you pasted suggest we're not getting a response from the backend within 10 seconds and so the client is reverting to offline behavior. But it's possible things are just slow for some reason.

JancoBH commented 6 years ago

My laptop is slower than the computer desktop in my work, today I did all the test today in my work and everything is fine again. I'm using Hotjar and I saw that 1 person when visited my web page never saw the content like me in my laptop, how can I solved this? In my laptop I have a bigger delay in loading than in my work.

Sometimes in the Firestore data viewer (as @mikelehen says), I have to refresh firebase to see the data.

Edit: I got "Unable to load documents" in Firestore data viewer, I opened the Add document modal without writing or doing something and after a little period of time I got the error message.

Luckygirlllll commented 6 years ago

@mikelehen I didn't see any delays in the loading

185driver commented 6 years ago

@mikelehen, you mentioned here about

not getting a response from the backend within 10 seconds

I'm getting this same error in my app, but only on first load. An immediate browser refresh works fine, as does successive backend calls every few minutes.

I'm not using offline mode, and am wondering if there is a way to extend the timeout beyond 10 seconds. I'm in a remote location with poor internet so more time would be helpful, unless I should handle the error by sending a successive call to the backend instead?

mikelehen commented 6 years ago

@185driver Thanks for the feedback. We're intending to look into exposing configuring this timeout in the future. For now, your options are probably either:

  1. Switch to using onSnapshot() instead of get() [this creates an ongoing listener which may end up raising an "empty" event from cache after 10 seconds but will continue listening and raise a new event if it eventually gets a response from the server].
  2. Just re-try the get() call if it fails or returns results from cache and you're willing to wait longer.

Note that soon (https://github.com/firebase/firebase-js-sdk/commit/8b29658a074bd48225efe81731e151251b0ed659) you'll be able to do .get({source: 'server'}). This will still be subject to the 10 second delay but you'll be able to use it to consistently get an error (rather than results from cache) in the case that we don't reach the backend.

Fax3D commented 6 years ago

I'm also having this issue in a Cordova Android app using web sdk (4.12.1). This error happens "randomly", while the app works perfectly for a certain time and then suddenly stop working gaving "Firestore (4.12.1): Could not reach Firestore backend". Reading the log, i also find this interesting error next to backend error:

ERR_SPDY_PING_FAILED firestore.googleapis.com/google.firestore.v1beta1.Firestore/Write/channel?database=XXXX....

From that point, only clearing the cache or reinstalling the app could solve the issue. Workaround described in #283 not helped me.

Thanks.

EDIT: It seems, but i'm not very sure, NOT enabling "enablePersistence" solve the issue.

185driver commented 6 years ago

@mikelehen, I've switched to using onSnapshot(). Thanks. I'm not seeing a way to capture the 'empty' event you mention above. I'd like to catch it and handle with a gentle note to the user that the data is coming in more slowly. As I'm not using offline mode, how might I do that?

mikelehen commented 6 years ago

@185driver Sorry for the delay. The behavior depends on whether you're listening to a query or a single document. If you're listening to a query, then you should get an empty QuerySnapshot with querySnapshot.empty == true and querySnapshot.metadata.fromCache == true after the 10 second delay if we couldn't reach the backend.

If you're listening to a single document, then you won't get an event until we actually receive a response from the backend, since we don't want to raise an event saying the document doesn't exist until we know for sure. So if you want to show a note to the user you should probably just implement your own timeout.

Hope this helps!

camstuart commented 6 years ago

Same problem for me here. and my Angular 5 code already uses onSnapshot()

mikelehen commented 6 years ago

@camstuart To be clear, you're also hitting this issue in a React Native app and the device is online and should be able to connect to the Firestore backend?

Frisbeetarian commented 6 years ago

Getting the same error. Code works fine locally, issue appears on firebase hosting after I firebase deploy.

mikelehen commented 6 years ago

@Frisbeetarian This issue is scoped to a React Native connectivity issue. If you are experiencing that error outside of React Native (which you must be if you're using Firebase Hosting) and the device has a working network connection that should be able to reach the Firestore backend, can you open a new issue with as much detail as possible? (code snippet, details on the device(s) that are having the issue, etc.)

mjsmagalhaes commented 6 years ago

Is this issue still happening?

https://status.firebase.google.com/incident/Console/18006 might have fixed any issues i had.

Frisbeetarian commented 6 years ago

@mikelehen I had forgotten to whitelist the site from uMatrix. My bad :#

exxmen commented 6 years ago

ran into this issue today. was working on my Vue project and for some reason, my project config details were changed when I turned on Firestore. the word "staging" became "stating" might be a good idea to also check your config details in case you encounter this issue for the first time

aranzuglia commented 6 years ago

In case this helps someone. I had the same issue in the browser's console: @firebase/firestore: Firestore (5.0.1): Could not reach Firestore backend.

As you can see I upgraded to latest Firebase Web SDK version. I was using 4.8.1 before, but both failed.

After turning on debugging using firebase.firestore.setLogLevel('debug') I could see the following: @firebase/firestore: Firestore (5.0.1) [Connection]: WebChannel received error: {"code":400,"message":"Request contains an invalid argument.","status":"INVALID_ARGUMENT"}

We had a few queries already using onSnapshot, but they had a limit of 1,000,000 .limit(1000000). After changing this value to a smaller one everything is working again!

There is no documentation I could find about it. The limit() method is documented but says nothing about a possible range. Something must have changed recently, as it was working perfectly until several days ago.

Just making sure you don't spend too many hours looking for this one ;)

mikelehen commented 6 years ago

@aranzuglia Oh, that's very interesting. Thanks for flagging this. We should definitely handle that better (either surface an error in the client or fix the backend to allow it). I'll see if I can figure out what changed and what the best path forward is. Thanks!

mikelehen commented 6 years ago

I'm closing this issue as I'm not sure there's anything actionable here. I was not able to reproduce @Luckygirlllll's issue (React Native was working when I tested a few weeks ago). We'll also be improving the "Could not reach Firestore backend" error message in the next release to provide more details. If anybody has a reproducible issue they believe to be a bug, please open a new issue. Thanks!

reedmarques commented 6 years ago

Please reopen this issue. Ive been struggling to get Firestore working on my React Native app for the past 3 days straight, and nothing so far. Realtime database works fine, same with authentication, but when it comes to reading or writing data to firestore, it doesnt work. IDK how to fix this!!

mikelehen commented 5 years ago

This issue has a confusing history with different symptoms and solutions. If you're experiencing an issue, please open a new issue with the exact details you're seeing (versions of Firestore / React Native, the exact error or incorrect behavior you're experiencing, etc.). This will avoid confusion and let us focus on the relevant details.

If you can also enable logging via firebase.firestore.setLogLevel('debug') and capture the log output, that'll help us diagnose the issue. And it'd be best to use the latest version of the firebase SDK as some of the log output has been tweaked recently. Thanks!

Luckygirlllll commented 5 years ago

Briefly about current situation this-is-fine-meme-625x350

mikelehen commented 5 years ago

Sorry if it seems like I'm not being as helpful as I could be. React Native has been a notoriously difficult environment for us to support. It is quirky and difficult to debug. We have found / fixed (or worked around) a variety of issues in the past. Our most recent fix was about a month ago and I did some tests and everything was working for me, but it's entirely possible that folks are still hitting problems under certain environments / conditions. But we have limited bandwidth to chase these issues and need all the help we can get. So for anybody hitting issues, please make sure you're using the very latest versions, and file a bug with all the details you can provide. If we can't reproduce the issue, there's a good chance we won't be able to diagnose and resolve it. :-/

reedmarques commented 5 years ago

Im importing everything properly I believe: // Current file that calls firebase import * as firebase from 'firebase'; import 'firebase/firestore';

// App.js var config = { apiKey: "", authDomain: "", databaseURL: "", projectId: "", storageBucket: "", messagingSenderId: "" }; const app = firebase.initializeApp(config); firebase.firestore().settings({timestampsInSnapshots:true})

My firebase and react native dependencies which are all up to date": { "firebase": "^5.0.4", "react": "16.3.1", "react-native": "0.55.4", } My log output when trying to read data from Firestore:

screen shot 2018-06-04 at 11 18 11 am

When I click on the https://firestore.googleapis.com link I get: 'Your client has issued a malformed or illegal request. Unknown SID That’s all we know.'

So when I try to set data, nothing happens at all. It seems to just skip the firebase.firestore().collection.ref.set()... call entirely. And when I try to get() data, it returns this 'client offline' error which must be the problem for not being able to write to firestore as well.

This is a huge bug :(

mikelehen commented 5 years ago

Bummer! If you open a new issue including repro steps, I can try to reproduce this. It'll be helpful if you start from a vanilla create-react-native-app created app. And be sure to specify whether this is iOS / Android / both.

aranzuglia commented 5 years ago

Why are the config elements empty? Only to avoid displaying them here?

Can you show the actual query?

reedmarques commented 5 years ago

Im not using Expo so I did react-native init. And Ive only tried on iOS so far, which doesnt work. @aranzuglia Yeah empty just to hide them, but theyre all copy and pasted from the firebase console so there are were typos

reedmarques commented 5 years ago

Okay so I just react-native init a new project and only npm installed firebase and firestore works... This was my old dependencies so maybe the interaction of one of these packages with Firestore doesnt work? Going to look into it "dependencies": { "firebase": "^5.0.4", "react": "16.3.1", "react-native": "0.55.4", "react-native-elements": "^0.19.1", "react-native-fbsdk": "^0.7.0", "react-native-fetch-blob": "^0.10.8", "react-native-image-picker": "^0.26.10", "react-native-permissions": "^1.1.1", "react-native-vector-icons": "^4.6.0", "react-navigation": "^2.0.4" },

mikelehen commented 5 years ago

Very interesting! Please let us know what you figure out.

JancoBH commented 5 years ago

Hi @mikelehen There is another issue open by another user, I got the same error but using Angular, I wrote there because this is an React Native issue, there I posted my error. https://github.com/firebase/firebase-js-sdk/issues/901