strukturag / pdfdraw

Nextcloud app to annotate PDF documents
GNU Affero General Public License v3.0
44 stars 10 forks source link

Stuck at "Establishing connection, please wait..." #14

Open Toraih opened 3 years ago

Toraih commented 3 years ago

I did a fresh install of Ubuntu 20.04.1 with a LEMP-stack and installed Nextcloud 20.0.5 the classic way (so far everything works fine).

I cloned the pdfdraw-repo including subs into the nextcloud-apps-folder, installed all requirements for the backend-server, configurated it (in files&admin) and started the backend-server.

: sudo /usr/bin/nodejs server.js

WARNING: Invalid certificates are allowed! Using pdftk to run as pdftk Using svg2pdf to run as svg2pdf listening on *:8080

If i open a PDF to Annotate, the PDF is loaded and displayed correctly (the annotation-tools are visible), but there's also a message overlay: Establishing connection, please wait..., that won't vanish...

In the same time server.js prints:

a user connected { token: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvbmV4dGNsb3VkLnZhbGVuY2lhLmNoIiwic3ViIjoibmNhZG1pbiIsImV4cCI6MTYxMTI0Mjc4MCwiZmlsZSI6IjciLCJmaWxlbmFtZSI6IlJlYXNvbnMgdG8gdXNlIE5leHRjbG91ZC5wZGYiLCJkaXNwbGF5bmFtZSI6Im5jYWRtaW4iLCJwZXJtaXNzaW9ucyI6Mjd9.nKRuIl600WAwfC-7zIswKwSKBRpGIqmdFxUK-D_fH94', EIO: '3', transport: 'websocket' } Token { iss: 'https://nextcloud.ourdomain.tld', sub: 'admin', exp: 1611242780, file: '7', filename: 'Nextcloud.pdf', displayname: 'admin', permissions: 27 } created room 7 user joined room 7 { displayname: 'admin', permissions: 27, userid: 'G0x14uIwnNSRwMmeAAAG' } Received items []

I can't do annotations, but drawing works but isn't saved. I can't find any error-messages on client- or server-side.

On closing the document, server.js prints:

user left room 7 { displayname: 'admin', permissions: 27, userid: 'G0x14uIwnNSRwMmeAAAG' } deleting empty room 7 a user disconnected

The only non 200 or 30x HTTP codes i noticed was a '101 Switching Protocols' from socket.io, which should be ok.

I tried for days, but couldn't find the problem... (i tried first on an active install of NC20 on a Ubuntu18, but had dependencies problems, so i started with a fresh maschine, the one i described here)

Any help is much appreciated!

cig0 commented 3 years ago

Hi @Toraih, are you running the server part behind an Nginx proxy, or connecting directly to it by setting up the server endpoint in NextCloud?

I created a Helm chart to deploy the server on a Kubernetes cluster and am facing the same issue.

Screen Shot 2021-01-22 at 17 23 13
baronluca commented 3 years ago

Hi, try with a different server where is installed Nextcloud (ubuntu 18.04 fresh install), i runthe docker version and the server version as Toraih (both works fine):

la@pdfdraw:/server$ nodejs server.js WARNING: Invalid certificates are allowed! Using /snap/bin/pdftk to run as pdftk Using /usr/local/bin/svg2pdf to run as svg2pdf listening on *:8080

i have the same error (on both launch),always "establishing connection.. please wait"

Any help is very appreciated.

spacyal commented 3 years ago

Hello Guys!

i have the same problem. The server is running in docker (port 8080). My Nextcloud is running behind an apache2 reverse proxy.

Is there an "translation" from the nginx proxy settings to apache2?

First i used the app version from git (with git clone in my apps directory) but it crashes nextcloud (blank page) ... with the app out of the app store it works to install but also the error... "Establishing connection, please wait..."

web console says if i use directly the ip (unfortunatly in german):
"Laden von gemischten aktiven Inhalten "http://10.0.0.4:8080/socket.io/?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvY2xvdWQuc3BhY3lhbC5jb20iLCJzdWIiOiJwYXRyaWNrYWRtaW4iLCJleHAiOjE2MTI3MTMxMDgsImZpbGUiOiI1NjMwMjgiLCJmaWxlbmFtZSI6IkUtTWFpbCBFaW5yaWNodHVuZy5wZGYiLCJkaXNwbGF5bmFtZSI6IkFkbWluaXN0cmF0b3IiLCJwZXJtaXNzaW9ucyI6Mjd9.HbHqJycVz4LZWmPAmb0hrbewcog7Y4b1k0GDbJKiu6g&EIO=3&transport=polling&t=NTu2nyP" wurde blockiert." - sounds like an certificate problem. So maybe accessing via reverse proxy is fixing the problem?

i tried with but didnt help

ProxyPass /socket.io http://127.0.0.1:8080/socket.io ProxyPassReverse /socket.io http://127.0.0.1:8080/socket.io ProxyPass /download/ http://127.0.0.1:8080/download/ ProxyPassReverse /download/ http://127.0.0.1:8080/download/

cig0 commented 3 years ago

Hello Guys!

i have the same problem. The server is running in docker (port 8080). My Nextcloud is running behind an apache2 reverse proxy.

Is there an "translation" from the nginx proxy settings to apache2?

First i used the app version from git (with git clone in my apps directory) but it crashes nextcloud (blank page) ... with the app out of the app store it works to install but also the error... "Establishing connection, please wait..."

web console says if i use directly the ip (unfortunatly in german): "Laden von gemischten aktiven Inhalten "http://10.0.0.4:8080/socket.io/?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvY2xvdWQuc3BhY3lhbC5jb20iLCJzdWIiOiJwYXRyaWNrYWRtaW4iLCJleHAiOjE2MTI3MTMxMDgsImZpbGUiOiI1NjMwMjgiLCJmaWxlbmFtZSI6IkUtTWFpbCBFaW5yaWNodHVuZy5wZGYiLCJkaXNwbGF5bmFtZSI6IkFkbWluaXN0cmF0b3IiLCJwZXJtaXNzaW9ucyI6Mjd9.HbHqJycVz4LZWmPAmb0hrbewcog7Y4b1k0GDbJKiu6g&EIO=3&transport=polling&t=NTu2nyP" wurde blockiert." - sounds like an certificate problem. So maybe accessing via reverse proxy is fixing the problem?

i tried with but didnt help

ProxyPass /socket.io http://127.0.0.1:8080/socket.io ProxyPassReverse /socket.io http://127.0.0.1:8080/socket.io ProxyPass /download/ http://127.0.0.1:8080/download/ ProxyPassReverse /download/ http://127.0.0.1:8080/download/

Maybe this online conversion tool can help you? http://labs.gidix.de/nginx/

rekXx commented 3 years ago

Hey,

Hi, try with a different server where is installed Nextcloud (ubuntu 18.04 fresh install), i runthe docker version and the server version as Toraih (both works fine):

la@pdfdraw:/server$ nodejs server.js WARNING: Invalid certificates are allowed! Using /snap/bin/pdftk to run as pdftk Using /usr/local/bin/svg2pdf to run as svg2pdf listening on *:8080

i have the same error (on both launch),always "establishing connection.. please wait"

Any help is very appreciated.

As far as I remember, a fresh install of nextcloud is configured to listen on port 80, isn't it? The pdf-annotations server tries to connect to nextcloud via 443 ssl. But this should have been mentioned in the server.js log as a connection error back to the nextcloud address.

I had the establishing connection message and wasn't able to draw or do anything when I tried to reach the pdf-annotations server directly via https. No user connection was mentioned by the server.js and no additional log was created.

I ended with a nginx reverse proxy for both my nextcloud and pdf-annotations server, that does the ssl termination and passes the connection via http. (As described in my post here)

The log posted by @Toraih looks good so far. Are you able to download the modified pdf file?

@baronluca Do you have the user connection mentioned in your server.js log? If both servers are in your local network, what happens if you try to connect from nextcloud to the pdf server via http:// as shown in the post above by @cig0

@spacyal

web console says if i use directly the ip (unfortunatly in german): "Laden von gemischten aktiven Inhalten "http://10.0.0.4:8080/socket.io/? token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvY2xvdWQuc3BhY3lhbC5jb20iLCJzdWIiOiJwYXRyaWNrYWRtaW4iLCJleHAiOjE2MTI3MTMxMDgsImZpbGUiOiI1NjMwMjgiLCJmaWxlbmFtZSI6IkUtTWFpbCBFaW5yaWNodHVuZy5wZGYiLCJkaXNwbGF5bmFtZSI6IkFkbWluaXN0cmF0b3IiLCJwZXJtaXNzaW9ucyI6Mjd9.HbHqJycVz4LZWmPAmb0hrbewcog7Y4b1k0GDbJKiu6g&EIO=3&transport=polling&t=NTu2nyP" wurde blockiert." - sounds like an certificate problem. So maybe accessing via reverse proxy is fixing the problem?

From which server is the log you have shown? Do you have a rule configured in your reverse proxy to pass /socket.io and /download to your pdf-annotations server or is the reverse proxy passing the whole traffic to your nextcloud instance which is blocking all non-ssl traffic?

baronluca commented 3 years ago

Sorry, try with a fresh install, same server for both (ngix + nextcloud + https) and docker running in the same machine. No way that it works.. sorry but i don't see any hint in your documentation to fix that.

baronluca commented 3 years ago

the problem it happens where you publish the nextcloud on https:// in http it works fine (but you will have problem when you download the file)