Did anyone using Firebase with Ionic run into this issue?
I’ve started implementing Firebase as the backend for my Ionic app (for auth and data) but I’m having one serious problem.
As long as I tested in a web browser (“ionic serve”) everything looked okay.
However once I started testing on a device (Android, Samsung Galaxy S3) with “ionic run”, the trouble began.
The problem I had (on the Android device) is that the response time on my auth/read/write operations was unpredictable. Most of the time it was like 2 to 4 seconds (for auth, retrieve or store), but occasionally (one out of ten) it was much longer (up to 30 seconds or a minute or a complete “hang”).
This happened with all operations: ref.authWithPassword(), ref.on() or ref.once(), ref.set() and so on. It seemed to be a random thing, the same operation that takes 2 seconds can take 30 seconds when I tried it a minute later.
After switching on detailed logging (Firebase.enableLogging), I saw this, for a “ref.authWithPassword”:
I/chromium( 8110): [INFO:CONSOLE] “2015-09-03 01:02:44 - Login start …”
I/chromium( 8110): [INFO:CONSOLE] "2015-09-03 01:03:00 - 2015-09-02T23:03:00.505Z: c:0:0: Closing unhealthy connection after timeout. "
So, the login operation starts at 1:02:44 (call to “ref.authWithPassword”), and then at 01:03:00 (16 seconds later), I see “Closing unhealthy connection after timeout”.
I suspect that in the other cases where I had a “slow” operation the issue is the same: it’s timing out on an “unhealthy connection”.
This happened late in the evening and when I re-tested the following morning the issue was gone. Scary because if this happens too frequently it’s sure to “kill” your app.
Did anyone else experience something like this? As I said it seemed to happen only on a device (maybe only on that particular device?), when testing in the browser I’ve never seen it.