Unable to save file to my server from OnlyOffice

Hi Team,

We are reviewing to use OnlyOffice as part of our application.
We have been able to install the Linux Community version and are using the APIs to invoke the editor and create a new document.

But when we exit the editor, the changes are not pushed to our server. But we are able to see the content when we reopen the file.

We are using the C# sample code and it is working in it.
But when we build our independent code it is not working?

Just to add -

  1. We have implemented the callbackURL
  2. We have added the handler and the needful code.

What we are seeing that the control is not coming to the callback handler at all…
Why could this be happening?

Regards
Venkatesh

Hi Venkatesh,
(I’m not from ONLYOFFICE)

I implemented to Backends for ONLYOFFICE (enaio and yuuvis).
Normally, ONLYOFFICE triggers the callbackURL after the last user (in edit mode) leaves the document (or press the save button) + a few seconds.

So I guess your that you ONLYOFFICE Instance can’t reach your callbackURL or the callback endpoint is not compatible (Method, Content-Type, Security). Do you check the log files of the DocService. Maybe it shows you more information’s about the error.

If you have still problems, it can help to add a debug proxy between your service and the ONLYOFFICE Service. So you can read the plain request and maybe find the cause of the error.
I used https://mitmproxy.org/ to check the request.

That ONLYOFFICE still shows your content is expected. It keeps the content until the last user left the edit mode and it can we witten to the backend.

A point I had my fist problems was, that the ID in ONLYOFFICE not use the same logic than my backends. A ONLYOFFICE ID for a document is only valid until the document will be closed. So it is the ID of the specific editing process.
But if you receive Force Save Callbacks (document still opened in edit mode), the ID is still valid. This kind of save operations just creates Revisions of the same document ID (relevant for the change history if you want to implement it).
So in my case, I had to implement a “Mapping” table between my documents (with versions) and the ONLYOFFICE IDs and Revisions. In this Mapping, I also saved the document changed history entries I received from ONLYOFFICE.

3 Likes

@uwohlfeil If the forum allowed more than one like for your post, I would give more. You understand the mechanism of Document server actions correctly.

@Venkat.n as uwohlfeil said, first of all try to check out mutual availability between Document server and your storage.

If no solution is found, please provide us with additional information about your installation. We’ll try to check it out together:

  1. Document server version and type of installation (docker, package)
  2. Point us to the guide which you used for installation.
  3. Reproduce the issue and provide us with whole Document server logs folder. It’s located:
    docker /app/onlyoffice/DocumentServer/logs/documentserver/
    package /var/log/onlyoffice/documentserver/

@uwohlfeil and @Alexandre - Thanks for the responses.

We are still facing the error. We are deploying the code using the C# sample as indicated above. Currently the progress we have made is that the control is coming to the handler but still the saving is not happening.

Please find the details as requested

  1. Document Server Versions is 6.3.2 - installation is docker on linux
  2. The Readme file is available at Upload files for free - README.md - ufile.io
  3. The log file is available at Upload files for free - out.log-20210810 - ufile.io

Any help is appreciated.

Thanks,
Venkat

Hi @Venkat.n,

this lines sounds like your backend can’t be accessed from the ONLYOFFICE Service.
Does you backend listen on localhost Port 64322 (from ONLYOFFICE perspective)?

[2021-08-12T05:20:13.735] [ERROR] nodeJS - postData error: docId = Khirz6zTPdfd7;url = http://localhost:64322/url-to-callback.ashx;data = {"key":"Khirz6zTPdfd7","status":1,"users":["uid-1628745613402"],"actions":[{"type":1,"userid":"uid-1628745613402"}]}
Error: connect ECONNREFUSED 127.0.0.1:64322

Best Regards
Uli

1 Like

Hello Venkat,
Have you somehow modified the code of C# integration example?
https://api.onlyoffice.com/editors/example/csharp
There is definitely an issue with your callback handler.

For instance, when the Document Server tries to send a status-2 message (file is ready to be saved) to the callback handler, in some cases it receives the following HTML page as a response:


But most of the time the callback handler is just inaccessible for the Document Server - Error: Invalid URI "http:/172.16.16.8:4040/url-to-callback.ashx"

I’d recommend you to perform a new installation:

  1. Install the C# integration example from scratch without code modifications, analyze how the callback handler is working there;
  2. Install a separate Document Server (not with DS+Nextcloud compose) and connect it to the example;
    Installation guide: Installation Guides - Docs - ONLYOFFICE
  3. After you make sure the integration is working, you may proceed to experimenting and tweaking the code according to your needs.
1 Like