Error while clicking the button Finish Registration on mobile app - smart light on Mongoose OS

I was trying to implement the smart light on Mongoose OS… After “Add device” button, setting the device name, wifi ssid and password, and when i click to finish the registration after switching back to the local network im getting an error :

Error : Network error. Please retry.

Can any one help me solve this

You’ll need to share some more details of the error otherwise it’s going to be very hard for anyone to help.
Have you checked the device logs? I assume you are seeing this message in some web interface.

im following this link https://github.com/cesanta/mongoose-os-smart-light

i am getting an error at web ui :

Error : Network error. Please retry.

The error log is throwing out the following error

2020/10/02 05:32:07 [info] 6#6: *241 upstream timed out (110: Operation timed out) while proxying upgraded connection, client: 172.18.0.1, server: smart-light.com, request: “GET /ws HTTP/1.1”, upstream: “http://172.18.0.2:8002/ws”, host: “192.168.1.3:8008”

log at backend

api-server_1 | PWA connected: ::ffff:172.18.0.4 , app: mos_app_hphfqlw81
api-server_1 | DASH -> {“method”:“POST”,“headers”:{“Authorization”:“Bearer 6de9f99d839f1e981138d6ff”,“Content-Type”:“application/json; charset=utf-8”},“url”:“http://dash:8001/api/v2/user/add",“data”:{“name”:“mos_app_hphfqlw81”,“pass”:"mos_app_hphfqlw81”}}
api-server_1 | DASH -> {“method”:“GET”,“headers”:{“Authorization”:“Bearer 6de9f99d839f1e981138d6ff”,“Content-Type”:“application/json; charset=utf-8”},“url”:“http://dash:8001/api/v2/devices",“auth”:{“username”:“mos_app_hphfqlw81”,“password”:"mos_app_hphfqlw81”}}

Anyone faced this issue… Thanks in advance

this is the msg console in mos tool

Just had a quick look of your logs, does your device ever connect to your WiFi? Or are you connecting to the device in AP mode? If it never connects to your home WiFi then I guess it wouldn’t be able to reach mDash, which might give you a network error.

I’ve not tried this example before, but I’d be trying to replicate the mDash API calls with the username/password you have here to make sure connectivity is OK and working as expected.

Thanks for looking into this issue which im facing :slight_smile:
I also noticed that one… In the cideo demo its mentioned the device will automatically connect to the local wifi. But for me, device is not automatically getting connected to local wifi. When i press the EN button on esp32, the system reboots and showing it as connected to local wifi. In that case also same error occurs. Attaching the logs of mos console after pressing the EN button.

Did you try to replicate the mDash API calls manually?

Looks like it got the address 192.168.1.8 and started a HTTP server, what happens when you navigate to that web address?

i think 192.168.1.8 is the ip of device(esp32)… if my understanding is wrong please correct me… also i tried with different network… but the result is same…
the log at server back end is

C:\mos\mongoose-os-smart-light\backend>docker-compose up
Starting backend_dash_1 … done
Starting backend_api-server_1 … done
Starting backend_nginx_1 … done
Attaching to backend_api-server_1, backend_dash_1, backend_nginx_1
api-server_1 | Connecting to ws://dash:8001/api/v2/notify?access_token=6de9f99d839f1e981138d6ff …
dash_1 | 2020/10/04 17:21:37 dash.go:1844: Listening on 0.0.0.0:8001
api-server_1 | Starting API Server on port 8002
api-server_1 | Dash connected.
api-server_1 | Dash message: {“id”:“b3b0bb64e13081ac4d08be9c”,“name”:“created”,“data”:null,“at”:“2020-10-04T17:30:14.919514324Z”}
api-server_1 |
api-server_1 | PWA connected: ::ffff:172.18.0.4 , app: mos_app_k7gm7zibq
api-server_1 | DASH -> {“method”:“POST”,“headers”:{“Authorization”:“Bearer 6de9f99d839f1e981138d6ff”,“Content-Type”:“application/json; charset=utf-8”},“url”:“http://dash:8001/api/v2/user/add",“data”:{“name”:“mos_app_k7gm7zibq”,“pass”:"mos_app_k7gm7zibq”}}
api-server_1 | DASH -> {“method”:“GET”,“headers”:{“Authorization”:“Bearer 6de9f99d839f1e981138d6ff”,“Content-Type”:“application/json; charset=utf-8”},“url”:“http://dash:8001/api/v2/devices",“auth”:{“username”:“mos_app_k7gm7zibq”,“password”:"mos_app_k7gm7zibq”}}
dash_1 | 2020/10/04 17:34:18 dash.go:231: /api/v2/devices [[Basic bW9zX2FwcF9rN2dtN3ppYnE6bW9zX2FwcF9rN2dtN3ppYnE=]] : No user for [mos_app_k7gm7zibq:mos_app_k7gm7zibq]
api-server_1 | (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: Cannot read property ‘data’ of undefined
api-server_1 | DASH ERROR: Request failed with status code 401
api-server_1 | PWA connection closed: ::ffff:172.18.0.4
api-server_1 | PWA connected: ::ffff:172.18.0.4 , app: mos_app_k7gm7zibq
api-server_1 | DASH -> {“method”:“POST”,“headers”:{“Authorization”:“Bearer 6de9f99d839f1e981138d6ff”,“Content-Type”:“application/json; charset=utf-8”},“url”:“http://dash:8001/api/v2/user/add",“data”:{“name”:“mos_app_k7gm7zibq”,“pass”:"mos_app_k7gm7zibq”}}
api-server_1 | DASH -> {“method”:“GET”,“headers”:{“Authorization”:“Bearer 6de9f99d839f1e981138d6ff”,“Content-Type”:“application/json; charset=utf-8”},“url”:“http://dash:8001/api/v2/devices",“auth”:{“username”:“mos_app_k7gm7zibq”,“password”:"mos_app_k7gm7zibq”}}
api-server_1 | PWA connection closed: ::ffff:172.18.0.4

can you give me an example for the api calls which i have to try. im a beginner with mongoose.

Also in the link for that demo, there was a step at backend

docker-compose run dash /dash --config-file /data/dash_config.json --register-user admin admin

should we run this at any time…

Anyone got idea about this