ONLYOFFICE / onlyoffice-nextcloud

The app which enables the users to edit office documents from Nextcloud using ONLYOFFICE Document Server, allows multiple users to collaborate in real time and to save back those changes to Nextcloud
GNU Affero General Public License v3.0
558 stars 157 forks source link

`forceSave` is failing [bug] #458

Open localjo opened 3 years ago

localjo commented 3 years ago

When trying to forceSave a document, it fails. I trigger a forceSave from the UI, and inspect the response from the websocket at wss://docs.mydomain.com/6.2.1-24/doc/300000001/c/511/tfjkjlsl/websocket, and see the following response:

{"type":"forceSave","messages":{"type":1,"time":1618740109000,"success":false}}

I expect to see something like:

{"type":"forceSave","messages":{"type":1,"time":1618740109000,"success":true}}

The request that the UI sends to the server before this is:

{"type":"forceSaveStart"}

I am unable to force save. I'm guessing there might be either some kind of networking issue between my docker containers or a file permissions issue. But it could be something else. I don't know which logs to check to figure out why the forceSave failed.

Which logs can I check?

DocumentServer version: Whatever is installed with the :latest tag from this docker image: https://registry.hub.docker.com/r/onlyoffice/documentserver/ so I guess something close to 6.3.0.58, but I don't know how to check.

Operating System: Ubuntu 20.04.2 LTS in a Docker container based on https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud

Browser version: Any

localjo commented 3 years ago

I found some logs that are probably relevant at /var/log/onlyoffice/documentserver/docservice/out.log:

[2021-04-18T10:05:00.960] [ERROR] nodeJS - sendServerRequest error: docId = 300000001;url = http://nginx-server/index.php/apps/onlyoffice/track?doc=<removed>;data = {"key":"300000001","status":7,"users":["<removed>"],"actions":[{"type":2,"userid":"<removed>"}],"lastsave":"2021-04-18T10:04:55.000Z","forcesavetype":1}
Error: Error response: statusCode:400; headers:{"server":"nginx/1.19.9","date":"Sun, 18 Apr 2021 10:05:00 GMT","content-type":"application/json; charset=utf-8","content-length":"27","connection":"keep-alive","x-powered-by":"PHP/7.4.16","expires":"Thu, 19 Nov 1981 08:52:00 GMT","pragma":"no-cache","set-cookie":["oc_sessionPassphrase=<removed>; path=/; secure; HttpOnly; SameSite=Lax","<removed>=<removed>; path=/; secure; HttpOnly; SameSite=Lax","__Host-nc_sameSiteCookielax=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=lax","__Host-nc_sameSiteCookiestrict=true; path=/; httponly;secure; expires=Fri, 31-Dec-2100 23:59:59 GMT; SameSite=strict"],"cache-control":"no-cache, no-store, must-revalidate","content-security-policy":"default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none'","feature-policy":"autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none'","x-robots-tag":"none"}; body:
{"message":"Url not found"}
    at Request._callback (/snapshot/server/build/server/Common/sources/utils.js:0:0)
    at Request.init.self.callback (/snapshot/server/build/server/Common/node_modules/request/request.js:185:22)
    at Request.emit (events.js:198:13)
    at Request.<anonymous> (/snapshot/server/build/server/Common/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:198:13)
    at IncomingMessage.<anonymous> (/snapshot/server/build/server/Common/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:286:20)
    at IncomingMessage.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1143:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)

But I'm not sure what it means.

Edit: I am not sure if this log is relevant, because trying to forceSave doesn't add an entry to this log, but the document ID of the document I am trying to forceSave matches the document ID in the log.

localjo commented 3 years ago

This looks like it might actually be a Nextcloud issue with this repo: https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud perhaps someone with the right GitHub privileges can move it there?

More specifically, I think this is related to setting up SSL certificates, using this PR as a starting point: https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud/pull/43

Basically, what seems to be happening is that the DocumentServer is making a request to Nextcloud, via the nginx proxy to save the document, but that request returns a 400 error, which I suspect may be related to a mis-configuration of some SSL settings.

ShockwaveNN commented 3 years ago

I've moving this issue to nextcloud repo, thanks

igwyd commented 3 years ago

hello, @localjo. I tried to reproduce your error, but i could not. The forcesave function works for me and there are no error in the documentserver logs and the websocket shows the true. Let's try to compare our installation steps and find the error.

Follow instruction here https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud/tree/feature/ssl#installation: Get repo this https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud/tree/feature/ssl from feature/ssl branch

git clone https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud -b feature/ssl

Go to "docker-onlyoffice-nextcloud" and create folder with name "certs". Get certificates from letsencrypt, copy fullchain.pem and privkey.pem to the folder "certs". Rename fullchain.pem -> tls.crt and privkey.pem -> tls.key Run docker-compose:

docker-compose -f docker-compose.yml -f ssl.yml up -d

Now launch the browser and enter the webserver address. The Nextcloud wizard webpage will be opened. Enter all the necessary data to complete the wizard. Go to the "docker-onlyoffice-nextcloud" and run script

bash set_configuration.sh

After enable ForceSave in UI and push "save" button. foresave Try use it in documents.