CollaboraOnline / richdocumentscode

Built-in CODE Server app
https://apps.nextcloud.com/apps/richdocumentscode
Apache License 2.0
111 stars 26 forks source link

Nextcloud 25.0.0 - Office 7.0.0 / Built-in CODE 22.5.702 document server not loading #202

Open Jolopu opened 1 year ago

Jolopu commented 1 year ago

I just updated to NC 25.0.0 and CODE 22.5.702 with Office 7.0.0 and PHP 8.1. When I switch to the built in server I get a green tick but when trying to open a docx I get a download dialog. I switched to the Ireland Demo Server and I could open all documents. After switching back to the built in server I get a "Cannot connect to the server" message. This goes away after reloading the page. But the documents still wont open.

This is the error message in the log:

[PHP] Fehler: Error: Return type of OCA\Richdocuments\Db\Wopi::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice at /var/www/clients/client309/web3882/web/cloud.mysite.com/apps/richdocuments/lib/Db/Wopi.php#190 at <>

  1. /var/www/clients/client309/web3882/web/cloud.mysite.com/apps/richdocuments/lib/Db/Wopi.php line 64 OC\Log\ErrorHandler::onError()
  2. /var/www/clients/client309/web3882/web/cloud.mysite.com/lib/composer/composer/ClassLoader.php line 571 include("/var/www/client ... p")
  3. /var/www/clients/client309/web3882/web/cloud.mysite.com/lib/composer/composer/ClassLoader.php line 428 Composer\Autoload\includeFile()
  4. /var/www/clients/client309/web3882/web/cloud.mysite.com/apps/richdocuments/lib/Db/WopiMapper.php line 161 Composer\Autoload\ClassLoader->loadClass()
  5. /var/www/clients/client309/web3882/web/cloud.mysite.com/apps/richdocuments/lib/Controller/WopiController.php line 394 OCA\Richdocuments\Db\WopiMapper->getWopiForToken()
  6. /var/www/clients/client309/web3882/web/cloud.mysite.com/lib/private/AppFramework/Http/Dispatcher.php line 225 OCA\Richdocuments\Controller\WopiController->getFile()
  7. /var/www/clients/client309/web3882/web/cloud.mysite.com/lib/private/AppFramework/Http/Dispatcher.php line 133 OC\AppFramework\Http\Dispatcher->executeController()
  8. /var/www/clients/client309/web3882/web/cloud.mysite.com/lib/private/AppFramework/App.php line 172 OC\AppFramework\Http\Dispatcher->dispatch()
  9. /var/www/clients/client309/web3882/web/cloud.mysite.com/lib/private/Route/Router.php line 298 OC\AppFramework\App::main()
  10. /var/www/clients/client309/web3882/web/cloud.mysite.com/lib/base.php line 1047 OC\Route\Router->match()
    1. /var/www/clients/client309/web3882/web/cloud.mysite.com/index.php line 36 OC::handleRequest()

GET /index.php/apps/richdocuments/wopi/files/40191_ocimqgraelno/contents?access_token=a6Hd3eZoW7Bppmmxocp7j1LBsW2GBqGM&access_token_ttl=1666570439000 from 52.51.221.25 at 2022-10-23T14:14:01+00:00

jabo59 commented 1 year ago

I have the same problem with a clean install of 25.0.0. Usage of demo server Ireland works as expected.

kray-nyan commented 1 year ago

I had seemingly the same problem after upgrading NC. Changing to a test server worked and switching back to the CODE server now seems to work, as well. I didn't manage to grab any relevant logs

Jolopu commented 1 year ago

Glad it worked out for you. I switched back and forth several times between demo servers and built-in server but no change. I even downgraded to several older versions of richdocuments and richdocumentscode. Then I got to the loading dialogue of the file but got stuck there. A well-known issue in other threads. NextOffice worked fine with NC24. Guess I have to wait until they come up with a fix for NC25.

kray-nyan commented 1 year ago

I found that changing back caused it to fail again eventually, but setting the option "use your own server" seems to work well enough. My URL was automatically filled, but looks like: https://host.domain.tld/apps/richdocumentscode/proxy.php?req=

MisterT87 commented 1 year ago

I have the same problem.

@kray-nyan This is not really a workaround - I am using Dockerized Nextcloud 25.0.1 with newest Built-In CODE. First it did not persist server reboots and even if I am not rebooting Nextcloud server: I have to change to "use your own server" at least every 24h.

I dont know if this is also a Browser thing or something else... but on my machine: If I change to "use your own server" the changes will be saved but Nextcloud instantly switch back to "use builtin CODE"

It will work for some hours for me, but like I said I have to do it every 24h at least on my machine

Jolopu commented 1 year ago

I just updated to NC 25.0.1 and tested. The problem persists.

Kairos-Admin commented 1 year ago

Hi everybody. I had the same issue and the solution for me was - in the nginx /etc/nginx/sites-available/nextcloud configuration file - to replace this line:

location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|ocs-provider/.+).php(?:$|/) {

By this line:

location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+|.+/richdocumentscode/proxy)\.php(?:$|/) {      But first (because the web interface of my Nexcloud was down after enabling Collabora Online - Built-in CODE Server), I had to disable "manually" the richdocumentscode app, using the console.

To do that:

$ cd /var/www/nextcloud $ su nextcloud $ php occ app:disable richdocumentscode

Then, the Nextcloud web interface came back. I've made the change I explained above (in /etc/nginx/sites-available/nextcloud). I've reactivated the Collabora Online - Built-in CODE Server app. Then, in [settings] [Nextcloud Office], I was able to select the Collabora Online - Built-in CODE Server and now it works !

stoically commented 1 year ago

@Kairos-Admin Was researching a bit, and it turns out that this change was added to the official NGINX docs a year ago: https://github.com/nextcloud/documentation/pull/7179

Unfortunately it doesn't help in my setup, as I'm running the official docker image, which has apache2 as webserver. Maybe it only worked for you because you basically did https://github.com/CollaboraOnline/richdocumentscode/issues/202#issuecomment-1293496857, but it'll stop working after a while, as https://github.com/CollaboraOnline/richdocumentscode/issues/202#issuecomment-1303067036 pointed out?

Either way, I wonder whether this should also get reported in the nextcloud server repo.

MisterT87 commented 1 year ago

issue still exist on Nextcloud 25.0.1 (Docker) and CODE Server 22.5.802

jatofg commented 1 year ago

I have the same issue on Apache after the update to Nextcloud 25. Nextcloud Office does not load with no errors logged.

The proxy redirect URL is probably incorrect. The following URL is being loaded, but returns an HTTP 400: https://[nextcloud URL]/apps/richdocumentscode/proxy.php?req=/cool/[wopi URL]

The correct redirect URL seems to be: https://[nextcloud URL]/apps/richdocumentscode/proxy.php?req=/browser/[some ID]/cool.html?WOPISrc=[wopi URL]

Der-Zohan commented 1 year ago

I have the same problem. Demo Server is running but built in not. Anyway Office config page says everything fine but documents can`t be opened.

Using NC25 on Ubuntu server with Apache and PHP8.1

Also tried to modify this line in apps/richdocuments/lib/Db/Wopi.php and add the mixed public function jsonSerialize():mixed {

Result is no more error in log but still not working :(

Der-Zohan commented 1 year ago

The suggestion to switch in office config to "use your own server" seems to be not poosible. The selection jumps back to built-in server after reloading the page

Joe-ncB commented 1 year ago

oh yes. Big update problem. On rpi nc24 php 8.0 CODE Server 22.5.802 everything was ok and works almost fine.

then i did the update to nc 25

pages wont open preferences said the server is available but when clicking on it it says server is not

checking nc/apps it said the server is not installed so even after i did the mod in php the update interrupted from terminal it said :

App "Collabora Online - Built-in CODE Server" cannot be installed because the following dependencies are not fulfilled: The following architectures are supported: x86_64

then i tried to install again and i got the answer

richdocumentscode already installed

but it is not working !!!

so what is going on here ????

hopfully someone can fix this ......

Joe-ncB commented 1 year ago

add on

when using LibreOffice from desktop i am able to connect to the server and edit the file

but the other way around -- editing a file from within nc25 -- is not working -- i can only download it (no options)

Joe-ncB commented 1 year ago

ok. Next ... when logging into the server (nc) from osx i can go to my documents and open a file to edit -- great this works !!!!!!!!!!!!!!!!!!!!

but from rpi, where the nc is installed the file will be downloaded -- hmmm ?????

what is not fixed is that i can not see the menu on osx -- will say select fonts, size, color, etc...... so as for the time it is not fixed i could work from rpi to edit things .... but now both possibilities are not satisfing

Der-Zohan commented 1 year ago

In Apache log I found this error. Somebody else have it and maybe can give a hint how to fix?

[Wed Nov 30 19:04:38.871179 2022] [proxy_fcgi:error] [pid 236734] [client 192.168.178.21:54136] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: socket_last_error(): Argument #1 ($socket) must be of type ?Socket, resource given in /var/www/nextcloud/apps/richdocumentscode/proxy.php:395\nStack trace:\n#0 /var/www/nextcloud/apps/richdocumentscode/proxy.php(395): socket_last_error()\n#1 {main}\n thrown in /var/www/nextcloud/apps/richdocumentscode/proxy.php on line 395'

image

Joe-ncB commented 1 year ago

now nothing is working and the protocoll says

[richdocuments] Fehler: GuzzleHttp\Exception\RequestException: cURL error 60: SSL certificate problem: self signed certificate (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://domain/apps/richdocumentscode_arm64/proxy.php?req=/hosting/capabilities at <>

  1. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php line 158 GuzzleHttp\Handler\CurlFactory::createRejection()
  2. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php line 110 GuzzleHttp\Handler\CurlFactory::finishError()
  3. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Handler/CurlHandler.php line 47 GuzzleHttp\Handler\CurlFactory::finish()
  4. /var/www/nextcloud/lib/private/Http/Client/DnsPinMiddleware.php line 113 GuzzleHttp\Handler\CurlHandler->__invoke()
  5. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php line 35 OC\Http\Client\DnsPinMiddleware->OC\Http\Client{closure}(" sensitive parameters replaced ")
  6. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php line 31 GuzzleHttp\PrepareBodyMiddleware->__invoke()
  7. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php line 71 GuzzleHttp\Middleware::GuzzleHttp{closure}(" sensitive parameters replaced ")
  8. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Middleware.php line 63 GuzzleHttp\RedirectMiddleware->__invoke()
  9. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php line 75 GuzzleHttp\Middleware::GuzzleHttp{closure}(" sensitive parameters replaced ")
  10. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php line 331 GuzzleHttp\HandlerStack->__invoke()
    1. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php line 168 GuzzleHttp\Client->transfer()
    2. /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Client.php line 187 GuzzleHttp\Client->requestAsync()
    3. /var/www/nextcloud/lib/private/Http/Client/Client.php line 218 GuzzleHttp\Client->request()
    4. /var/www/nextcloud/apps/richdocuments/lib/Service/CapabilitiesService.php line 131 OC\Http\Client\Client->get()
    5. /var/www/nextcloud/apps/richdocuments/lib/Service/CapabilitiesService.php line 74 OCA\Richdocuments\Service\CapabilitiesService->refetch()
    6. /var/www/nextcloud/apps/richdocuments/lib/AppInfo/Application.php line 80 OCA\Richdocuments\Service\CapabilitiesService->getCapabilities()
    7. /var/www/nextcloud/lib/private/AppFramework/Bootstrap/FunctionInjector.php line 67 OCA\Richdocuments\AppInfo\Application->OCA\Richdocuments\AppInfo{closure}(" sensitive parameters replaced ")
    8. /var/www/nextcloud/lib/private/AppFramework/Bootstrap/BootContext.php line 51 OC\AppFramework\Bootstrap\FunctionInjector->injectFn()
    9. /var/www/nextcloud/apps/richdocuments/lib/AppInfo/Application.php line 135 OC\AppFramework\Bootstrap\BootContext->injectFn()
    10. /var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php line 190 OCA\Richdocuments\AppInfo\Application->boot()
    11. /var/www/nextcloud/lib/private/legacy/OC_App.php line 208 OC\AppFramework\Bootstrap\Coordinator->bootApp()
    12. /var/www/nextcloud/lib/private/legacy/OC_App.php line 141 OC_App::loadApp()
    13. /var/www/nextcloud/cron.php line 55 OC_App::loadApps()

at 2022-11-30T18:25:02+00:00

Joe-ncB commented 1 year ago

strange things going on here ...

Der-Zohan commented 1 year ago

so I tried now to set up the docker version of collabora/code without any luck. Docker container is running fine and Nextcloud says connection is working but dockument can't be loaded.

I removed community server and Nextcloud office completely. Afterwards I added the app again.

Now I facing this error running Ubuntu Server 20.04, Apache2 and PHP8.1

{"reqId":"kXPKdjvOsDqTPIbO3reC","level":3,"time":"2022-11-30T21:16:53+00:00","remoteAddr":"192.168.179.84","user":"54327116-732E-4F83-99BE-D26E8631A703","app":"PHP","method":"GET","url":"/index.php/apps/richdocuments/index?fileId=6785951&requesttoken=DvdWw3XoXAhPSM18riO819fFaGtOEJWuSvLfv1Tgsm8%3D%3AWJ8StRHfFn4EB4s7lxTMpL2mIRMfJtKZGJG%2B%2Bxun%2BBw%3D&path=%2Ftapete.xlsx","message":"Return type of OCA\\Richdocuments\\Db\\Wopi::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice at /var/www/nextcloud/apps/richdocuments/lib/Db/Wopi.php#190","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.56","version":"25.0.1.1","exception":{"Exception":"Error","Message":"Return type of OCA\\Richdocuments\\Db\\Wopi::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice at /var/www/nextcloud/apps/richdocuments/lib/Db/Wopi.php#190","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/richdocuments/lib/Db/Wopi.php","line":64,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/composer/composer/ClassLoader.php","line":571,"args":["/var/www/nextcloud/apps/richdocuments/lib/Db/Wopi.php"],"function":"include"},{"file":"/var/www/nextcloud/lib/composer/composer/ClassLoader.php","line":428,"function":"Composer\\Autoload\\includeFile"},{"file":"/var/www/nextcloud/apps/richdocuments/lib/Db/WopiMapper.php","line":75,"function":"loadClass","class":"Composer\\Autoload\\ClassLoader","type":"->"},{"file":"/var/www/nextcloud/apps/richdocuments/lib/TokenManager.php","line":224,"function":"generateFileToken","class":"OCA\\Richdocuments\\Db\\WopiMapper","type":"->"},{"file":"/var/www/nextcloud/apps/richdocuments/lib/Controller/DocumentController.php","line":173,"function":"getToken","class":"OCA\\Richdocuments\\TokenManager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"index","class":"OCA\\Richdocuments\\Controller\\DocumentController","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"id":"6387c84bbfe0f"}

Der-Zohan commented 1 year ago

If I fix the file again like mentioned here https://github.com/CollaboraOnline/richdocumentscode/issues/202#issuecomment-1326309016

I get a new error

`[PHP] Error: Error: explode(): Passing null to parameter #2 ($string) of type string is deprecated at /var/www/nextcloud/apps/richdocuments/lib/TokenManager.php#142 at <>

  1. <> OC\Log\ErrorHandler::onError()
  2. /var/www/nextcloud/apps/richdocuments/lib/TokenManager.php line 142 explode()
  3. /var/www/nextcloud/apps/richdocuments/lib/Controller/DocumentController.php line 173 OCA\Richdocuments\TokenManager->getToken(" sensitive parameters replaced ")
  4. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 225 OCA\Richdocuments\Controller\DocumentController->index()
  5. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 133 OC\AppFramework\Http\Dispatcher->executeController()
  6. /var/www/nextcloud/lib/private/AppFramework/App.php line 172 OC\AppFramework\Http\Dispatcher->dispatch()
  7. /var/www/nextcloud/lib/private/Route/Router.php line 298 OC\AppFramework\App::main()
  8. /var/www/nextcloud/lib/base.php line 1047 OC\Route\Router->match()
  9. /var/www/nextcloud/index.php line 36 OC::handleRequest()

GET /index.php/apps/richdocuments/index?fileId=3400202&requesttoken=XLJmzM4VwB6nBL9eV7jKAmWGCue6eIlRwxMB5Mo8AI4%3D%3ACtoiuqoiimjsS%2FkZbo%2B6cQ%2FlQ5%2FrTs5mkXBgoIV7Sv0%3D&path=%2FDokumente%2FKostenrechnung2018.ods from 192.168.179.84 by 54327116-732E-4F83-99BE-D26E8631A703 at 2022-11-30T21:24:27+00:00`

Der-Zohan commented 1 year ago

okay for me it's working now using the docker version. I made an error setting up the container. I set the wrong url and got therefore this error

No acceptable WOPI hosts found matching the target host

Thought I had to set the url of the collabora server but you have to use the one of the Nextcloud instance. :)

I followed now this guide https://collabora-online-for-nextcloud.readthedocs.io/en/latest/install/

but instead using domain parameter I worked with -e aliasgroup1 to use multiple domains. Found this hint here https://www.c-rieger.de/nextcloud-mit-collabora-office/

hope it helps :)

Joe-ncB commented 1 year ago

lucky man im not using docker nor nginx just the built-in server ...

Joe-ncB commented 1 year ago

i can't understand this

i downloaded the ios app -Collabora Office- there i created a test file

then from rpi (see above) i could open the file and was able to modify it ---- WOW

so now all seems to be ok but how long ?? i have no clue

so everything is working and needs 'only' some stability !!

lets see how long this will last

that's it for the moment

Obi-Wahn commented 1 year ago

same problems after the upgrade from nextcloud 24.0.8 to nextcloud 25.0.2.

as a workaround: onlyoffice works.

jabo59 commented 1 year ago

Curious observation: Three instances, two on 25.0.1 and one on 24.0.8. Upgrade from 25.0.1 to 25.0.2 worked fine on all instances.

App version on all three instances: Collabora Online - Built-in CODE Server - 22.5.802 Nextcloud Office - 7.0.2

But only on one of the former 25.0.1 instances clicking on a document server icon opens it in CODE. In the other two instances the document is downloaded.

Any idea to figure out why this is the case.

Joe-ncB commented 1 year ago

i can load everything from osx-safari (not all icons), osx-firefox, rpi-chromium, rpi-libreoffice, ios-collaOffice sometimes i need to load two or three times until it is loaded

now i wanted to fix security-issues by filling in my ip addresses in "Allow list for WOPI requests"

maybe i do not understand the docu but then nothing is working except from ios i wrote the computer name and the ip addresses of each etc.....

finally i deleted all and left empty so it is still not safe ......

EddyLB commented 1 year ago

Same issue with NextCloud 25.0.2, Nextcloud Office 7.0.2, Collabora Online - Built-in CODE Server 22.5.802 Documents are not opened in CODE but downloaded and no clue in the Apache and PHP logs :=(

ernolf commented 1 year ago

It looks to me that a lot of different issues are coming together here. For some of you - certainly not for all - the workaround in #206 could help to get the magic happen. deeplink

timur-g commented 1 year ago

I counted 12 reporters. There may be multiple issues here. Some confirmed using dockerized Nextcloud, others didn't specify. May be useful to update with OS, do you use proxy and which, how is SSL, and if NC is native or docker, did you look in CODE logs, and of course if you still have the problem.