Back

SocketException (SocketException: Failed host lookup: 'api.abc.com'

  • 0
  • Flutter
Vedsaga
5 May, 2023, 09:50
TypeScript
sError:
OSError (OS Error: No address associated with hostname, errno = 7)
errorCode:
7
message:
"No address associated with hostname"
TL;DR
The user is experiencing a SocketException with the message "Failed host lookup: 'api.abc.com'". They have tried to replicate the issue but have not been able to. They suggest setting a breakpoint to check the endpoint or request. The user double checked the endpoint and it appears to be correct. It is suspected that the Client or endpoint is being reset, causing the issue. The user suggests creating an issue or recreating the instance of the Client when the internet is back online. This issue occurs when the app is opened without internet, then the internet is turned on and the account.get() method is called. The error message "
Vedsaga
5 May, 2023, 09:53

It only happens when...

TypeScript
1. One the app with internet off and then turn on the internet
2. Then call the account.get()
3. Got this error
Vedsaga
5 May, 2023, 09:58

it seems for some reason if you try to create instance of Client when there is no internet and if you switch on the internet then client instance will keep throwing this error ... Till you don't manually close the app and reopen. So, that when instance hostname lookup will happen this time considering internet is switched on

Vedsaga
5 May, 2023, 10:00

I guess, what should have happened was if hostname lookup fail happen then re-attempt should have been made couple of once more time...

I guess this is place where concept of interceptor would be handy, remember couple of months back brought this into noticed I guess...

Vedsaga
5 May, 2023, 10:01

for now I guess I have I will have change something... at my project Arch-level I guess to recreate the instance of Client when user-internet is backonline...

Vedsaga
5 May, 2023, 10:09

should I create issue for this?

Drake
5 May, 2023, 16:05

I'm pretty sure seeing this because the Client or endpoint is being reset.

Vedsaga
5 May, 2023, 16:10

I have double checked it actually, I am available loading endpoint from env and Appwrite service class is singleton so, not sure how would that happen but, I will double check if that's case. From what I observed I can say that I see the host name same in both cases

Drake
5 May, 2023, 16:15

try to double check the endpoint before the API call is made

Drake
5 May, 2023, 16:16
Vedsaga
5 May, 2023, 16:17

On it, I am gonna try in in just couple mins and update here

Vedsaga
5 May, 2023, 17:00

for some reason it's happening anymore πŸ‘€ have tried to replicate but not happening... very wired

Vedsaga
5 May, 2023, 17:02

I will let it open if it happen again then report here else I will close

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more