m8schmit / ecovacs-stack

A complete stack including backend server and frontend interface, to manage a Deebot T9.
GNU General Public License v3.0
29 stars 7 forks source link

Unable to connect to frontend in browser #2

Closed shanks3042 closed 10 months ago

shanks3042 commented 1 year ago

I set up everything according to https://github.com/m8schmit/ecovacs-stack#how-to-install and https://github.com/m8schmit/ecovacs-stack/issues/1

My frontend .env looks like REACT_APP_HOST_IP=192.168.1.249

and the backend .env like

BOTID=8561*********************
BOTCLASS=a*****
RESOURCE=5***
HOST_IP=192.168.1.249

I also tried setting the HOST_IP to the IP of my vacuum robot as it's not clear which one to use.

When i try to access 192.168.1.249:4200 I only get an error that the site can not be found. image

192.168.1.249:3000 only shows a blank page. image

When I attach to the docker container of the backend I always see this error message:

ecovacs-stack-backend-1   | error Error: unable to verify the first certificate
ecovacs-stack-backend-1   |     at TLSSocket.onConnectSecure (node:_tls_wrap:1550:34)
ecovacs-stack-backend-1   |     at TLSSocket.emit (node:events:514:28)
ecovacs-stack-backend-1   |     at TLSSocket._finishInit (node:_tls_wrap:967:8)
ecovacs-stack-backend-1   |     at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:743:12) {
ecovacs-stack-backend-1   |   code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
ecovacs-stack-backend-1   | }

The frontend shows this error message: ecovacs-stack-frontend-1 | info There appears to be trouble with your network connection. Retrying...

m8schmit commented 1 year ago

Hi I never seen this bug and don't really had the occasion to dive in the code since ~ 6 months. But we will find a solution.

The HOST_IP variable should be your private ip. So it's good like this.

1/ Do you run this on you local machine? If yes could you try with http://localhost:4200/ otherwise could you test it on your local machine and go to http://localhost:4200/. 2/ the certificates should be generated on each restart, could you try to restart the backend container? Something like docker-compose restart ecovacs-stack-backend-1 or even restart all the containers.

If the problem persists, I might need more logs.

Telecline commented 1 year ago

Hi, great project, the front end looks amazing! I'm having a similar issue getting it running.

Followed setup instructions, but was unable to access the front end at the server IP on port 4200.

The backend periodically gives the leaf signature error below:

error Error: unable to verify the first certificate
    at TLSSocket.onConnectSecure (node:_tls_wrap:1550:34)
    at TLSSocket.emit (node:events:514:28)
    at TLSSocket._finishInit (node:_tls_wrap:967:8)
    at TLSWrap.ssl.onhandshakedone (node:_tls_wrap:743:12) {
  code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'
}

After some time, and trying to access the front end again, the backend logged this:

WebSocket client connected ***** (total: 1)
[ERROR] 19:51:47 Error: Table 'dev.bot_events' doesn't exist
Child got SIGTERM, exiting.

@shanks3042 did you manage to get it running?

lmdc45 commented 12 months ago

https://github.com/mqttjs/MQTT.js/issues/271

could get the error about the self signed certificate disappear by adding client = connect('mqtts://localhost:8883', {rejectUnauthorized: false})

in backend/mqttClient/mqttclient.js

not sure why it is not accepting the configured rootCA.pem

lmdc45 commented 12 months ago

and the other issue seems to be due ti the mysql init script using reserved keyword read

can be fixed by changing read to 'read' in mysql/scripts/ init.sql. might need to remove the mysql/data folder as well to reinitialize before restarting docker compose

m8schmit commented 11 months ago

Hi, sorry for the lack of news, I don't have much time.

So about the certificate errors. Did you all run UID="$(id -u)" GID="$(id -g)" docker-compose up?

if no:

You need to! Otherwise, the default UID/GID will be used (0) and you will be logged as root. But the NODE_EXTRA_CA_CERTS look for rootCA.pem in the node home.

if yes:

what is the output of id -u, id-g?
From my understanding any other UID/GID than 0 will be good to be logged as node.

For the mysql error, thanks @lmdc45 I'll fix it soon.

Finally for the unable to connect error. I guest we will see once everything else will be fixed.

Thanks for your patience, keep me updated!

slade87 commented 11 months ago

@m8schmit I created a PR https://github.com/m8schmit/ecovacs-stack/pull/4 for convenience, feel free to merge and close this ticket or adjust to your liking.

m8schmit commented 10 months ago

I think we can close this one, the MR from @slade87 fix the issue in SQL and using the command UID="$(id -u)" GID="$(id -g)" docker-compose up should fix the ssl error until I fix this properly.

shanks3042 commented 8 months ago

Thanks, I got it partially working with the following steps:

  1. Clone the repository as user with id 1000
  2. Create a .env file with UID=1000 and GID=1000
  3. docker-compse up

If I clone the repository with my root user which runs the docker container I need the fix from lmdc45