Upgrade to NextCloud 23 prevents online document editing in Collabora online: Files download instead of edit


After my recent effort in upgrading gitlab I decided to take a crack at updating NextCloud to version 23. On the surface it all went well - upgrading the dockerized version from 21 → 23 went smoothly and without any obvious errors.

Unfortunately, it appears that online document editing a-la Collabora Online [w/ Built-in CODE Server] has a problem when performing an upgrade installation. When attempting to edit a document in-browser I am prompted to download the file - no in-browser editor appears to load(?).

References

Restore in-browser Editing

These steps worked for me to restore in-browser document editing with Collabora / open office online. In summary: replace the richdocuments app with an older version, enable it via web-ui then install the Built-in CODE Server

  • Login to NextCloud as an Admin

  • Navigate to ‘+ Apps’

  • Disable and then remove both of these apps:

    • Collabora Online - Built-in CODE Server
    • Collabora Online
  • Shell into your container and perform the following actions:

    • cd /var/www/html/custom_apps
    • wget https://github.com/nextcloud/richdocuments/releases/download/v4.1.2/richdocuments.tar.gz
    • tar xf richdocuments.tar.gz
    • chown -R www-data:www-data richdocuments These actions stage an older version of the richdocuments app to your NextCloud instance. This older version seems to work where the latest version (5.0.0 at the time of this writing) fails to operate
  • Back in the Admin web UI:

    • Navigate to ‘+ Apps’
    • Enable Collabora Online
    • Enable the ‘unsupported version’ anyway, if prompted
    • Then be sure to Activate as this is a separate step

      This will ensure that the older richdocuments app is configured to operate DO NOT UPGRADE richdocuments to 5.0.0 (at least until they fix the issue!)

  • Back in your container shell:

    • /var/www/html/occ config:system:set allow_local_remote_servers --value true --type bool

      • I needed this to allow a ‘local’ connection to the CODE server
    • sudo -u www-data php -d memory_limit=512M /var/www/html/occ app:install richdocumentscode ** At this point the server-side components should be installed and enabled

  • Back in the Admin Web UI:

    • Navigate to Settings
    • Select Administration → Collabora Online
    • Select Use your own server
    • Save
    • Select Use the built-in CODE - Collabora Online Development Edition option
    • Save
  • Optional(?) in your container shell:

    • sudo -u www-data php /var/www/html/occ preview:repair -vvv ** This seemed to be required for me to load documents. YMMV

At this point I could create new documents as well as open existing documents and edit them in the browser-based LibreOffice UI.

Errors

These are a few errors I encountered during the process which helped me fumble my way to helpful online resources.

[PHP] Error: ZipArchive::open(): Using empty file as ZipArchive is deprecated at /var/www/html/lib/private/Archive/ZIP.php#50

GET /core/preview?fileId=123456&c=987654322&x=250&y=250&forceIcon=0&a=0
from 192.168.111.111 by admin at 2021-12-11T23:26:19+00:00
[richdocuments] Info: Failed to convert file to preview

GET /core/preview?fileId=7329&c=987654322&x=250&y=250&forceIcon=0&a=0
from 192.168.111.111 by admin at 2021-12-11T23:26:16+00:00
GuzzleHttp\Exception\ServerException: Server error: `POST https://domain.tld/custom_apps/richdocumentscode/proxy.php?req=/lool/convert-to/png` resulted in a `502 Bad Gateway` response: <html><body><h1>502 Bad Gateway</h1> The server returned an invalid or incomplete response. </body></html>&nbsp;
[no app in context] Info: Deprecated event type for OCA\Files::loadAdditionalScripts: Symfony\Component\EventDispatcher\GenericEvent is used

GET /apps/files/?dir=/
from 192.168.111.111 by admin at 2021-12-11T23:26:12+00:00
[no app in context] Warning: Host 10.11.12.13 was not connected to because it violates local access rules

GET /core/preview?fileId=5&c=026fb40f765d40afe3bdbc9624dd3a7d&x=250&y=250&forceIcon=0&a=0
from 192.168.111.111 by admin at 2021-12-11T23:24:37+00:00