Support Topics Documentation Slack YouTube Blog

Error: java.net.ConnectException: Failed to connect to api.backendless.com/66.114.116.4:443

Hi
Lately I am randomly getting this error throughout my app

Error: java.net.ConnectException: Failed to connect to api.backendless.com/66.114.116.4:443

My app id is E27B10A2-C4B9-A5A6-FF6A-AB65CBE35A00

The device is conected to the wifi router and the connection is stable . Is there anything happening with our app ?

Thank You
Constantin

Hello Constantin,

The URL used by default in our SDKs is https://api.backendless.com. I am not sure where the other part in the referenced message comes from. The error references Java, however you tagged the post with JavaScript. Which one are you using?
The error appears to be specific to your client-side environment. If it were something more generic, we’d be hearing about it from a lot of people.

Regards,
Mark

Hi Mark
Thanks for the reply.

I am using Nativescript + Angular for my app and the Backendless Javascript SDK

That’s the error I am seeing in the debug console when I print out the response header:

“originalStack”: “Error: java.net.ConnectException: Failed to connect to api.backendless.com/66.114.116.4:443\n at new ZoneAwareError (file:///data/data/…/files/app/vendor.js:92218:33)\n at onRequestComplete (file:///data/data/…/files/app/vendor.js:98555:34)\n at Object.onComplete (file: node_modules@nativescript\core\http\http-request\http-request.android.js:43:0)”

I just did a lookup and 66.114.116.4 IP resolves to backendless.com though I do not know how it gets added to the api URL

Thanks,
Constantin

Hi Constantin,

Could you try opening up https://api.backendless.com in a browser on the machine/device where the error occurs?

Do you get a normal (non-error) response?

Regards,
Mark

Yep, I see the ‘All works’ message

This tells me the browser can connect to our servers just fine. Does the problem happen when you run it on an Android device?

Yes, it’s on an android version 10 device

What version of Android SDK is it? Some earlier versions didn’t have all the ciphers to do SSL handshake.

Hi Mark
It’s version 10

Thank you and I apologize about asking a redundant question.

  • Could you try disconnecting from Wi-fi and use only provider’s mobile data. Does the problem happen then?
  • Does the problem happen in Android emulator on the desktop?
  • Does the problem happen on other Android devices?

Mark

Sorry I should have mention it does not happen on emulators. Actually one of the emulators runs same android 10 version.

As for mobile data it happens same as with wifi, and it is random. i.e. I can navigate through the app just fine but it randomly stops and throws the network error.

I will try with other devices

Hi Mark
I was searching for the “Network error” message that shows up in my console and found it in \node_modules\backendless-request\es\index.js line 117

request.onerror = function handleErrorEvent() {
reject(new Error(‘Network Error’));
request = null;
};

If I debug the request path before the request is opened I see the path is correct

https://api.backendless.com/..../data/ServiceStation?pageSize=10&offset=0&loadRelations=location&where=Judet%3D’HUNEDOARA’

On the request.onerror I print out the request and we get this

{
“UNSENT”: 0,
“OPENED”: 1,
“HEADERS_RECEIVED”: 2,
“LOADING”: 3,
“DONE”: 4,
“_responseType”: “”,
“_listeners”: {},
“_readyState”: 4,
“_options”: {
"url": “https://api.backendless.com/....data/ServiceStation?pageSize=10&offset=0&loadRelations=location&where=Judet%3D’HUNEDOARA’”,
“method”: “GET”,
“headers”: {}
},
“_errorFlag”: true,
“_response”: {
"originalStack": "Error: java.net.ConnectException: Failed to connect to api.backendless.com/66.114.116.4:443\n at new ZoneAwareError (file:///data/data/com.leadingedge.motocare/files/app/vendor.92218:33)\n at onRequestComplete (file:///data/data/com.leadingedge.motocare/files/app/vendor.98555:34)\n at Object.onComplete (file: node_modules@nativescript\core\http\http-request\http-request.android.43:0)"
** },**
“_responseTextReader”: null,
“_headers”: null,
“_status”: null,
“_sendFlag”: false
}

Could there be an issue with the backendless request js?

Thank you,
Constantin

Hi Constantin,

Please take a look at the stack trace.

As you can see the call originates here:

node_modules@nativescript\core\http\http-request\http-request.android.43:100:

This is outside of backendless-request. It has something to do with that node module.
Have you tried the things we discussed? Such as running the app on another Android device? Different version of Android perhaps?

Regards,
Mark

Hi Mark
A bit difficult to get other devices right now due to isolation but I will try soon.
I wanted to eliminate everything else, and indeed this is not caused by the backendless-request but weirdly enough is only happening when calling api.backendless.com. My app also calls a weather api and google places + maps api and it does not happen with those calls. And giving the randomess of this it is very difficult to trace it down. I will try other devices and hopefully it won’t be an issue.
Thank you very much for your time,
Constatin

Hi Constantin,

I am on Android 9 (OxygenOS 9.0.11). I’ll be happy to try it on my phone, if you’d like. Send me the APK and I’ll give it a shot.

Cheers,
Mark

Thanks Mark I apreciate it
I did some code review and found an uncaught error in a chain of requests to backendeless. When this error occurs any other subsequent calls to backendless throw network error until I restart the app. That error is fixed but I found another way to reproduce and that’s when the device goes in idle mode. When the activity resumes the call to backenless throws network error, but if I navigate to another activity and get back then it works.

So I need to think about when the user will actually have no network and better handle the error. Anyway I will put together a simple app and try reproduce this and will send it to you. Thanks again for your time.

Constantin