LoRaServer MQTT - Network Error <nil>

LoRaServer MQTT - Network Error

When setting up the LoRaServer using an MQTT broker different to Eclipse Mosquitto you may find the following errors in your log.

Log:

level=info msg="starting LoRa Server" band=EU_863_870 docs="https:/www.loraserver.io/" net_id=000000 version=3cdb0c9
level=info msg="setup redis connection pool" url="redis://lora-redis-ha.default.svc.cluster.local:6379"
level=info msg="connecting to postgresql"
level=info msg="gateway/mqtt: connecting to mqtt broker" server="tcp://mqtt-broker.default.svc.cluster.local:1883"
level=error msg="gateway/mqtt: connecting to mqtt broker failed, will retry in 2s: Network Error : %!s(<nil>)"
level=error msg="gateway/mqtt: connecting to mqtt broker failed, will retry in 2s: Network Error : %!s(<nil>)"
...

Solution

Most likely is an actual authentication or network error. Double check your user, password and network config. I think the lack of descriptive response such authentication error (that you would receive with Mosquitto) is due to your MQTT broker sending a response that the LoRaServer application does not understand.

Other users are experiencing the same issue:

At first, I thought this issue was with Kubernetes or GKE. However, if I run the LoRaServer as a standalone and connect to the MQTT broker using the public IP address, the exact issue still occurs.

Log:

level=info msg="gateway/mqtt: connecting to mqtt broker" server="ssl://mqtt.example.com:8883"
level=error msg="gateway/mqtt: connecting to mqtt broker failed, will retry in 2s: Network Error : %!s(<nil>)"

I am using Aedes NodeJS MQTT broker: https://github.com/mcollina/aedes.

If I change to tcp://test.mosquitto.org:1883 and remove the username and password the LoRaServer connects immediately.

Turns out it was simply an authentication error. I think due to the use of a different MQTT broker the authentication response was not valid for the mqtt client in the loraserver application and therefore responded with a error instead of authentication.

1 Like

Thanks for sharing @jcrocker-ecomon :+1: