Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to connect to frontend in browser #2

Closed
shanks3042 opened this issue Jul 24, 2023 · 8 comments
Closed

Unable to connect to frontend in browser #2

shanks3042 opened this issue Jul 24, 2023 · 8 comments

Comments

@shanks3042
Copy link

shanks3042 commented Jul 24, 2023

I set up everything according to https://github.com/m8schmit/ecovacs-stack#how-to-install and #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
Copy link
Owner

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
Copy link

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
Copy link

lmdc45 commented Dec 6, 2023

mqttjs/MQTT.js#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
Copy link

lmdc45 commented Dec 6, 2023

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
Copy link
Owner

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
Copy link
Contributor

slade87 commented Jan 6, 2024

@m8schmit I created a PR #4 for convenience, feel free to merge and close this ticket or adjust to your liking.

@m8schmit
Copy link
Owner

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants