NativeScript / nativescript-app-sync

♻️ Update your app without going through the app store!
MIT License
125 stars 24 forks source link

Unable to resolve host "appsync-server.nativescript.org" #52

Closed Ajitweb closed 4 years ago

Ajitweb commented 4 years ago

I am testing with an nativescript angular app and I get the following error

: ERROR Error: Uncaught (in promise): Error: java.net.UnknownHostException: Unable to resolve host "appsync-server.nativescript.org": No address associated with hostname JS: Error: java.net.UnknownHostException: Unable to resolve host "appsync-server.nativescript.org": No address associated with hostname JS: at new ZoneAwareError (file:///node_modules\@nativescript\angular\zone-js\dist\zone-nativescript.js:1298:0) JS: at onRequestComplete (file:///node_modules\@nativescript\core\http\http-request\http-request.js:54:0) JS: at Object.onComplete (file:///node_modules\@nativescript\core\http\http-request\http-request.js:43:0)

I can access to that website through a browser - so access is not an issue. I am testing it through an emulator

EddyVerbruggen commented 4 years ago

Hi, did you try that URL in a mobile browser while you were not connected over wifi? Perhaps there's a firewall blocking the site or something.

Ajitweb commented 4 years ago

Hello Eddy,

Thanks for the fast response. Sorry - my bad. It is now working as intended. It was not working in my office environment - but it is working at home.

In the office, I could browse to https://appsync.nativescript.org/apps without any issues - but the emulator cannot access it. I am the admin of the network - so I know that there is no firewall etc (and thats why I could go visit the website through the browser). Cannot figure it out.

Anyway, there is nothing wrong with your module - so the issue is solved.

Instead of checking for the updates on resumeEvent, I have given a button in the drawer, so that the user can update the app. Is there a way to "await" the fetching without making changes to the 'promise' in your code. I want to show a spinner while the update is being fetched.

Thanks once again Eddy.

Ajitweb commented 4 years ago

Hello Eddy,

More digging - and found that the emulator can access IP address but not the domain name when on office network. - so something was wrong with the DNS Servers.

It seems that if we use the emulator on different networks, it remembers the DNS setting of the previous network and hence we get the 'Unable to resolve host....' error message. So what was happening is, when I am in office, it used the DNS setting of my home wifi router.

The solution is given here

If i change network (like office and home), then it is always better to 'Cold boot' the emulator