-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[🐛] 🔥 Expected [auth/network-request-failed], got [auth/unknown] internal error #4690
Comments
Interesting - even the previous bug looks like a workaround of something that is really a https://github.com/firebase/firebase-android-sdk/ problem, have you checked upstream to see what's happening there and/or if you can reproduce it with a base-java quickstart? https://github.com/firebase/quickstart-android/tree/master/auth is the basis for those |
Hi! No, I haven't checked the android SDK directly. I guess I first should upload I'm not very familiar with how react-native-firebase works together with the native SDKs. Should these errors just be passed through "untouched", ideally? How do I know the Android SDK is not behaving as expected? (comparing to iOS version?) I can perhaps report an issue to firebase-android-sdk, but I don't think I have time to investigate much deeper before next year. First of all I need to deploy a quickfix of my app before Dec 23. 🎄 |
Errors should in general pass untouched. I believe there are more than a hundred possible native errors across the native SDKs, and all but a couple (one of which was your previous PR) are passed untouched yes. Normally we only customize error messages when the platforms for some reason differ (like this) or when they just don't handle a certain type of error, but those are best fixed upstream yes. The relationship of this react-native module to the native SDKs is essentially "wrap the APIs to expose them in the simplest most passthrough manner possible, while making the react-native API conform in general to the firebase-js-sdk API". There's not much more to it, and that's a big enough task The only way to know the native SDK is behaving is to do a quick reproduction based off their quickstarts |
I am receiving this errors multiple times after upgrading to v.10.2.0 |
A quickfix/hack is simply adding a check on error.code === 'auth/network-request-failed'
+|| (error.code === 'auth/unknown' && error.message.includes('Unable to resolve host')) |
@perrosnk moving the issue forward would involve doing the recommended background work:
Also you might try v10.3.1 and making sure that the underlying firebase-android-sdk / firebase-ios-sdk are at their current releases (which you will get by default in v10.3.1 but if you have them overrridden you should update or remove the version override) @perrosnk What did you find when you did the recommended background work? |
@mikehardy unfortunately I don't know how to do what you have asked I noticed that I stopped getting this kind of error mentioned in this issue and this |
If I had to guess, you have some sort of restricted local network. The error seems fairly explicit. |
@mikehardy I am only seeing this error in production. I haven't been able to reproduce it locally and I don't really understand how this could be possible. |
@draperunner By the way, on your firebase dashboard do you see any users coming from China? Could this be a reason ? (China blocking Google addresses) I am getting some users from China although Play Store is not available in China and I cannot understand it. |
You have a production user with some kind of restricted or non functional network. I could be wrong but I think the network environment of a mobile phone is highly variable and frequently inactive no? The error message appears quite explicit. |
Chinese users are quite inventive when it comes to getting around restrictions, via side loads of play store, or direct transfers and downloads of apps. Once your digital bits are available to any single person, you can expect that any other single person in any other location may get a copy of them - this is true for any digital bits. |
I am still seeing this error quite a lot and I am still trying to understand the reason. I have observed:
2.1 2.2 2.3 2.4 2.5
|
On a quick glance, it appears DNS fails to resolve the token URL needed to get a token, and the rest of the failures are likely downstream of that. If I had to take a random guess of what percentage of my users was having bizarre network activity at the moment (on some hotel captive portal, out in the hill country, at a cafe where the connection dropped) 1 in 300 doesn't seem crazy. 0.37%. I'm not saying things could not be improved but here is my question: if a mobile device can't resolve the name of the API server needed to get a fresh token, what exactly can this module do about it? I can't think of anything |
I believe that if that was the case we should be seeing a similar pattern in iOS devices, but we aren't. We are getting 0 errors in iOS devices. I am attaching some more errors but I am not sure if they are related:
|
is it not reasonable to expect iOS and Android networking to work differently? They're fully separate SDKs. Everything you post looks like "transient network failure" to me. I can't think of anything to do about it |
But why am I seeing errors on the google cloud console (Token Sevice API)? And only from the Android API? |
This is how I see it. On Android, if the device is totally offline and the ID token is expired, an error of the type I have been able to reproduce this by logging in to my app on an emulator, turning wi-fi off, waiting for the token to expire (> 1 hour) and then open the app again (still with wifi off, and therefore no internet access at all). The It's not that the error doesn't make sense. Of course the DNS servers cannot be contacted, since the device is offline. But one used to get an |
It does sound like a firebase-android-sdk issue, I'm not sure how we could do anything about it other than special-casing the exception handling but it's much better to pursue this upstream |
If android emulator is in offline mode, this problem will continue to occur, and the exception cannot be caught by |
@oHuflying - have you pursued this upstream? Do you have a PR you'd propose? |
calling the following method was causing the issue for me: |
It's tracked here: firebase/firebase-android-sdk#2251 |
This is apparently fixed in upstream BoM 26.6.0 https://firebase.google.com/support/release-notes/android#bom_v26-6-0 and thus should be available as part of v11.0.0+ here https://github.com/invertase/react-native-firebase/blob/master/CHANGELOG.md#1100-2021-03-03 Anyone that saw this originally - can you still reproduce on RNFBv11+ (using firebase-android-sdk 26.6.0+)? |
The linked issue is about to stale-close, if this is still failing for anyone with firebase-android-sdk 26.6.0+ / react-native-firebase v11.0.0+ speak now or this closes out... |
I'll try and find the time to check this out some time this week. |
New info upstream indicates it actually is fixed in auth 20.0.4 which is not present until firebase-android-sdk BoM 27.0.0 which is not compatible here yet #5150 - but if you're not using Only AdMob had breaking changes from BoM v26.x.x and BoM 27.0.0 |
v12 should have this included + fixed |
i created app web works fine but , sign in , register of apk file face this error:[firebase_auth/unknown]com.google.firebase.j an internal error has occurred.[json conversation failed!]failed to parse error for string [ <metacharset=utf-8> <meta name=viewportcontent="initial-scale=1 , minimum-scale=1,width=device-width"> <title>Error403(Forbidden)!!</title> <style> *{margin:0;padding:0}html,code{front}].............. |
dont know what to do pls help |
@sardsiders you should probably log your own issue, but please do your homework first and log a good issue, or no one will be able to help https://stackoverflow.com/help/how-to-ask |
Issue
auth().currentUser.getIdToken()
fails with the following message:If all of these:
I would expect an error of the type
Error: [auth/network-request-failed]
.To preserve offline functionality, this check on [auth/network-request-failed] is important to me.
This is very similar to another issue I reported earlier this year: #3654. Maybe some regression?
Project Files
Javascript
Click To Expand
package.json
:firebase.json
for react-native-firebase v6:# N/A
iOS
Click To Expand
ios/Podfile
:# N/A
AppDelegate.m
:// N/A
Android
Click To Expand
Have you converted to AndroidX?
android/gradle.settings
jetifier=true
for Android compatibility?jetifier
for react-native compatibility?android/build.gradle
:// N/A
android/app/build.gradle
:// N/A
android/settings.gradle
:// N/A
MainApplication.java
:// N/A
AndroidManifest.xml
:<!-- N/A -->
Environment
Click To Expand
react-native info
output:react-native-firebase
version you're using that has this issue:10.2.0
Firebase
module(s) you're using that has the issue:Authentication
TypeScript
?N
React Native Firebase
andInvertase
on Twitter for updates on the library.The text was updated successfully, but these errors were encountered: