DocumentServer icon indicating copy to clipboard operation
DocumentServer copied to clipboard

Empty content in /var/www/onlyoffice/documentserver/web-apps/apps/api/documents/api.js

Open logicexpertise opened this issue 7 months ago • 1 comments

This issue is unique.

  • [x] I have used the search tool and did not find an issue describing my bug.

Operating System of DocumentServer

Linux (RPM package)

Version information

8.2.0

Expected Behavior

After installing from rpm package and testing from NextCloud and/or Moodle, document should load in the browser.

Actual Behavior

When I try to open a document in Nexcloud or Moodle, I get an error "ONLYOFFICE Document Server cannot be reached. Please contact admin."

On looking at the files on the Onlyoffice Document Editor server, I see that the file /var/www/onlyoffice/documentserver/web-apps/apps/api/documents/api.js has a length 0f 0 bytes.

Downgrading to v8.1.3 resolves the issue.

Reproduction Steps

Install/upgrade documentserver to > 8.2.0 Try to open a document from Moodle/Onlyoffice. (Note, documents opened with no issues prior to upgrading OO-DS)

Additional information

No response

logicexpertise avatar May 25 '25 05:05 logicexpertise

Hello @logicexpertise, try updating to the current version 8.3.3. During the update, agree to replace the files if a dialog appears. Do not leave your old files ones because they contain important changes. If the error persists, please provide the document server log with the error and a screenshot of the error from the browser dev-tools.

igwyd avatar May 27 '25 08:05 igwyd

Hello @igwyd I finally got to doing some deeper troubleshooting of this. It seems the immediate cause is that /var/www/onlyoffice/documentserver/web-apps/apps/api/documents/api.js.tpl isn't copied to /var/www/onlyoffice/documentserver/web-apps/apps/api/documents/api.js by the postinstall scriptlet (I'm on RockyLinux, installing using dnf). The copy is done in /usr/bin/documentserver-flush-cache.sh. However, that doesn't run because the postinstall scriptlet fails because the database connection with CONNECTION_PARAMS="-h$DB_HOST -U$DB_USER -w" in the scriptlet fails, as it doesn't specify the database name (specified in local.json, along with the other database connection parameters), which causes the scriptlet to exit and not run /usr/bin/documentserver-flush-cache.sh My workaround for now is to run documentserver-flush-cache.sh and documentserver-configure.sh manually after dnf install/upgrade I am now running the current version 9.0.2

PS: It seems that documentserver-configure.sh updates the values of storage.fs.secretstring, services.CoAuthoring.token.secret.inbox|outbox|session in local.json. Why? Isn't the point of local.json to override settings that may change during upgrades?

logicexpertise avatar Jul 04 '25 06:07 logicexpertise

@logicexpertise sorry for the late answer, did you run documentserver-configure.sh when you changed the database? If not, then postinstall did not find this data while upgrade and that is why you received an error.

The script documentserver-configure.sh has additional parameters so as not to change the JWT https://github.com/ONLYOFFICE/document-server-package/blob/master/rpm/bin/documentserver-configure.sh.m4#L154 and you can comment out https://github.com/ONLYOFFICE/document-server-package/blob/master/rpm/bin/documentserver-configure.sh.m4#L570 so you don't have to change securelink.

igwyd avatar Aug 01 '25 08:08 igwyd