DNS resolve or somthing else?

I have an edge device that sometimes works fine on bootup but occasionally gets stuck connecting to Losant. Restarting the docs-agent fixes this issue, but I want to know how to prevent it from happening during device bootup.

This issue seems to appear randomly on some of the devices.
During this phase ping to network works fine.

2024-02-15T19:12:51.721Z [info] Agent Starting...
2024-02-15T19:12:51.733Z [info] Agent Version: 1.43.3
2024-02-15T19:12:52.054Z [info] Webserver started on port: 8080
2024-02-15T19:12:52.071Z [info] Workflows initialized and running...
2024-02-15T19:12:52.073Z [info] Connecting to: mqtts://broker.losant.com ...
2024-02-15T19:12:52.204Z [info] Local broker listening on 0.0.0.0:1883
2024-02-15T19:12:57.576Z [info] Connected to: mqtts://broker.losant.com
2024-02-15T19:12:58.069Z [info] Peripheral device updates received from Losant and applied.
2024-02-15T19:12:58.120Z [info] Workflows received from Losant and applied.
2024-02-15T19:12:58.131Z [info] Workflows received from Losant and applied.
2024-02-15T19:42:52.041Z [info] 0 workflow(s) run since agent startup.
2024-02-15T19:53:25.204Z [info] Workflows received from Losant and applied.
2024-02-15T19:53:29.893Z [info] Debugging status changes received from Losant and applied.
2024-02-15T20:03:22.981Z [info] Debugging status changes received from Losant and applied.
2024-02-15T20:12:51.697Z [info] 2 workflow(s) run since Thu Feb 15 2024 19:42:52 GMT+0000 (Coordinated Universal Time).
2024-02-15T20:17:13.112Z [info] Workflows received from Losant and applied.
2024-02-15T20:17:36.201Z [info] Workflows received from Losant and applied.
2024-02-15T20:18:20.348Z [info] Workflows received from Losant and applied.
2024-02-15T20:31:00.362Z [info] Peripheral device updates received from Losant and applied.
2024-02-15T20:38:55.194Z [info] Peripheral device updates received from Losant and applied.
2024-02-15T20:39:52.802Z [info] Peripheral device updates received from Losant and applied.
2024-02-15T20:40:33.628Z [info] Peripheral device updates received from Losant and applied.
2024-02-15T20:40:58.092Z [info] Peripheral device updates received from Losant and applied.
2024-02-15T20:42:49.432Z [info] Agent Starting...
2024-02-15T20:42:49.444Z [info] Agent Version: 1.43.3
2024-02-15T20:42:49.822Z [info] Webserver started on port: 8080
2024-02-15T20:42:49.841Z [info] Workflows initialized and running...
2024-02-15T20:42:49.843Z [info] Connecting to: mqtts://broker.losant.com ...
2024-02-15T20:42:49.983Z [info] Local broker listening on 0.0.0.0:1883
2024-02-15T20:42:50.019Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2024-02-15T20:42:50.024Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2024-02-15T20:42:50.063Z [warn] MQTT client disconnected.
2024-02-15T20:43:15.094Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2024-02-15T20:43:15.101Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2024-02-15T20:43:15.102Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}
2024-02-15T20:43:40.058Z [info] Attempting to reconnect to mqtts://broker.losant.com...
2024-02-15T20:43:40.068Z [warn] MQTT client error:
{"errno": -3001, "code": "EAI_AGAIN", "syscall": "getaddrinfo", "hostname": "broker.losant.com"}

Hi @Doraditya_Nandanamud, and welcome to the Losant Forums!

Generally this error means the gateway is having trouble establishing any kind of internet connection. The next time this happens, I recommend trying something like ping google.com (in a Linux terminal) to see if you can get any kind of response.

Let us know if you are still having issues connecting to our broker even if ping google.com returns a result.