firebase / firebase/firebase-android-sdk
com.google.firebase.FirebaseNetworkException: A network error (such as timeout, interrupted connection or unreachable host)
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 710
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 31
Description
### [READ] Step 1: Are you in the right place? YES
### [REQUIRED] Step 2: Describe your environment
* Android Studio version: 3.6.3_
* Firebase Component: Auth (Database, Firestore, Storage, Functions, etc)
* Component version: 19.4.0
### [REQUIRED] Step 3: Describe the problem
#### Steps to reproduce:
My app is production with over 500k downloads on google play and some user (i dont know exactly why) have this error when logging in...
```
com.google.firebase.FirebaseNetworkException: A network error (such as timeout, interrupted connection or unreachable host)
at com.tomatedigital.giveawaymaster.task.LoginTask.lambda$firebaseAuth$1(LoginTask.java:249)
at com.tomatedigital.giveawaymaster.task.-$$Lambda$LoginTask$p6eSSF8vZ2BATwhlFttcJl8qT-w.onComplete(-.java)
at com.google.android.gms.tasks.zzi.run(zzi.java:4)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
```
there is no an easy connection between these users, different android versions, different phone models.... i found this old issue: https://github.com/firebase/firebase-android-sdk/issues/384 but seems that someone in firebase team just trew it under the carpet instead of solving it (very common here)
the error is happening in real devices in production,
Some users with problem come to support and ive asked to reinstall the app but they keep error... also it is not a INTERNET CONNECTION problem because people are talking to me in an online chat and having the problem in the same time
crashlytics show it is happening in 1% of sessions... but it is always same users
#### Relevant Code:
```
FirebaseAuth.getInstance().signInWithCustomToken(token).addOnCompleteListener(AsyncTask.THREAD_POOL_EXECUTOR, task -> {
if (task.isSuccessful()) {
FirebaseCrashlytics.getInstance().log("new firebase token successfully authenticated");
} else {
App.shouldNeverHappen(new RuntimeException(task.getException().getMessage() + " data: " + sb.toString()));
this.exception = task.getException();
}
});
//token is generated in my Firebase cloud functions as
auth.createCustomToken(uid).then(function(customToken) {
res.status(200).send(customToken);
}).catch(function(error) {
console.error("Error creating custom token:" + JSON.stringify(error));
res.status(200).json({
e: error
});
});
```
Contributor guide
Assessment
This issue has not been assessed yet.