CollaboraOnline / richdocumentscode

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

Could not establish connection to the Collabora Online server. #145

Open ghezeli opened 3 years ago

ghezeli commented 3 years ago

Hi I install Collabora Online - Built-in CODE Server successfully but when try to configure Collabora Online to connect i get this error Could not establish connection to the Collabora Online server.

craigbartdev commented 3 years ago

Having the same issue here

JC-S commented 3 years ago

I have the same problem upgrading from 6.4.1103 to 6.4.1303. Old version worked just fine. I'm running it as nextcloud 22.2 built-in CODE server on arm64 platform.

ezntek commented 3 years ago

Same issue here,

Exception: Could not find urlsrc in WOPI/var/www/html/xflynextcloud/apps/richdocuments/lib/TokenManager.php - line 202: OCA\Richdocuments\WOPI\Parser->getUrlSrc("application ... n")/var/www/html/xflynextcloud/apps/richdocuments/lib/Controller/DocumentController.php - line 222: OCA\Richdocuments\TokenManager->getToken("* sensiti ... ")/var/www/html/xflynextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 217: OCA\Richdocuments\Controller\DocumentController->index(" sensiti ... *", null)/var/www/html/xflynextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 126: OC\AppFramework\Http\Dispatcher->executeController(OCA\Richdocu ... {}, "index")/var/www/html/xflynextcloud/lib/private/AppFramework/App.php - line 156: OC\AppFramework\Http\Dispatcher->dispatch(OCA\Richdocu ... {}, "index")/var/www/html/xflynextcloud/lib/private/Route/Router.php - line 301: OC\AppFramework\App::main("OCA\Richdo ... r", "index", OC\AppFramew ... {}, { _route: "r ... "})/var/www/html/xflynextcloud/lib/base.php - line 1000: OC\Route\Router->match("/apps/richdocuments/index")/var/www/html/xflynextcloud/index.php - line 36: OC::handleRequest()

rschr commented 3 years ago

Same here (with the AMD64 version in Nextcloud 20.0.13), since CODE server version 6.4.1303. Workaround for me was to revert manually to version 6.4.1103. See also https://github.com/CollaboraOnline/richdocumentscode/issues/111#issuecomment-947498693; it's not the first time this issue has come up.

Magicrafter13 commented 3 years ago

Running on Latest Nextcloud, and Fedora (34 I think). From nginx error log:

FastCGI sent in stderr: "PHP message: richdocumentscode (proxy.php) error exit, PID: 64516, Message: no_glibc" while reading upstream, client: [redacted], server: [redacted], request: "GET /apps/richdocumentscode/proxy.php?req=/hosting/discovery HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/www.sock:", host: "[redacted]"

No SELinux errors are generated when trying to get this to work. I even removed it completely from Nextcloud and reinstalled the app, still no new SELinux issues.

glibc is most certainly installed.

Also, it worked fine at some point, but after some system upgrades (which usually cause issues) I'm back here again. I spent a while fixing it last time, and I don't remember what I did to finally make the no_glibc go away. I think most of what I did was fixing SELinux issues, but that's no longer applicable now so I don't know what to do.

Edit: AND, apparently if I comment out lines 147 and 148 of the app's proxy.php file (the part returning the error) and try to edit a document it works fine. Very strange. While I would say the error check is flawed, it looks to me like it should only do that if the AppImage returns an error code of any kind, or fails to run for some reason, which apparently it isn't, so it must be returning an error code, yet it seems to work fine. I do think the error check should check the exact value though, unless the AppImage literally only returns a non-zero value if glibc is missing, but that seems unlikely to me.

HeyWatchOutDude commented 3 years ago

Same issue.

Nextcloud logs: GuzzleHttp\Exception\ConnectException: cURL error 28: Connection timed out after 45001 milliseconds (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://cloud.example.com/apps/richdocumentscode/proxy.php?req=/hosting/discovery

lbdroid commented 2 years ago

Edit: AND, apparently if I comment out lines 147 and 148 of the app's proxy.php file (the part returning the error) and try to edit a document it works fine. Very strange. While I would say the error check is flawed, it looks to me like it should only do that if the AppImage returns an error code of any kind, or fails to run for some reason, which apparently it isn't, so it must be returning an error code, yet it seems to work fine. I do think the error check should check the exact value though, unless the AppImage literally only returns a non-zero value if glibc is missing, but that seems unlikely to me.

This is definitely where the key is. From the ld-linux manual page; "LD_TRACE_LOADED_OBJECTS If set (to any value), causes the program to list its dynamic dependencies, as if run by ldd(1), instead of running normally."

For some reason (that I'm not aware of), when running with that flag set through php/exec, it has a return value of "5" rather than the expected "0". I'm running Rocky Linux (RHEL downstream) 8.5. Commenting out those two lines (I also comment out 146 because it doesn't do any good to keep it) fixes the problem.

solracsf commented 2 years ago

Similar issue here, if this error can help debug it:

{
   "reqId":"By8xCDaHivvyhkPuDzw7",
   "level":3,
   "time":"2021-11-25T10:53:29+01:00",
   "app":"richdocuments",
   "method":"GET",
   "url":"/apps/richdocuments/index?fileId=4002&requesttoken=JD5ZwqetUjwrk6zlxGEKHZSVZCm7PbmOpuFjkOhs0A0%3D%3ATEkUlMj7PntFx86JlBYzaeb9AGvRRIH6k7EB6Z8%2Fqmw%3D",
   "message":"cURL error 28: Operation timed out after 45000 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://example.com/apps/richdocumentscode/proxy.php?req=/hosting/discovery",
   "userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:94.0) Gecko/20100101 Firefox/94.0",
   "version":"22.2.3.0",
   "exception":{
      "Exception":"GuzzleHttp\\Exception\\ConnectException",
      "Message":"cURL error 28: Operation timed out after 45000 milliseconds with 0 bytes received (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for https://example.com/apps/richdocumentscode/proxy.php?req=/hosting/discovery",
      "Code":0,
      "Trace":[
         {
            "file":"/app/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php",
            "line":158,
            "function":"createRejection",
            "class":"GuzzleHttp\\Handler\\CurlFactory",
            "type":"::",
            "args":[
               {
                  "sink":{
                     "__class__":"GuzzleHttp\\Psr7\\Stream"
                  },
                  "headers":[

                  ],
                  "response":null,
                  "request":{
                     "__class__":"GuzzleHttp\\Psr7\\Request"
                  },
                  "options":{
                     "0":"And 5 more entries, set log level to debug to see all entries",
                     "verify":false,
                     "timeout":45,
                     "nextcloud":{
                        "allow_local_address":true
                     },
                     "synchronous":true,
                     "handler":{
                        "__class__":"GuzzleHttp\\HandlerStack"
                     }
                  },
                  "errno":28,
                  "onHeadersException":null,
                  "createResponseException":null,
                  "__class__":"GuzzleHttp\\Handler\\EasyHandle"
               },
               {
                  "0":"And 36 more entries, set log level to debug to see all entries",
                  "errno":28,
                  "error":"Operation timed out after 45000 milliseconds with 0 bytes received",
                  "appconnect_time":0.057162,
                  "url":"https://example.com/apps/richdocumentscode/proxy.php?req=/hosting/discovery",
                  "content_type":null
               }
            ]
         },
         {
            "file":"/app/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php",
            "line":110,
            "function":"finishError",
            "class":"GuzzleHttp\\Handler\\CurlFactory",
            "type":"::",
            "args":[
               {
                  "__class__":"GuzzleHttp\\Handler\\CurlHandler"
               },
               {
                  "sink":{
                     "__class__":"GuzzleHttp\\Psr7\\Stream"
                  },
                  "headers":[

                  ],
                  "response":null,
                  "request":{
                     "__class__":"GuzzleHttp\\Psr7\\Request"
                  },
                  "options":{
                     "0":"And 5 more entries, set log level to debug to see all entries",
                     "verify":false,
                     "timeout":45,
                     "nextcloud":{
                        "allow_local_address":true
                     },
                     "synchronous":true,
                     "handler":{
                        "__class__":"GuzzleHttp\\HandlerStack"
                     }
                  },
                  "errno":28,
                  "onHeadersException":null,
                  "createResponseException":null,
                  "__class__":"GuzzleHttp\\Handler\\EasyHandle"
               },
               {
                  "__class__":"GuzzleHttp\\Handler\\CurlFactory"
               }
            ]
         },
         {
            "file":"/app/3rdparty/guzzlehttp/guzzle/src/Handler/CurlHandler.php",
            "line":47,
            "function":"finish",
            "class":"GuzzleHttp\\Handler\\CurlFactory",
            "type":"::",
            "args":[
               {
                  "__class__":"GuzzleHttp\\Handler\\CurlHandler"
               },
               {
                  "sink":{
                     "__class__":"GuzzleHttp\\Psr7\\Stream"
                  },
                  "headers":[

                  ],
                  "response":null,
                  "request":{
                     "__class__":"GuzzleHttp\\Psr7\\Request"
                  },
                  "options":{
                     "0":"And 5 more entries, set log level to debug to see all entries",
                     "verify":false,
                     "timeout":45,
                     "nextcloud":{
                        "allow_local_address":true
                     },
                     "synchronous":true,
                     "handler":{
                        "__class__":"GuzzleHttp\\HandlerStack"
                     }
                  },
                  "errno":28,
                  "onHeadersException":null,
                  "createResponseException":null,
                  "__class__":"GuzzleHttp\\Handler\\EasyHandle"
               },
               {
                  "__class__":"GuzzleHttp\\Handler\\CurlFactory"
               }
            ]
         },
         {
            "file":"/app/lib/private/Http/Client/DnsPinMiddleware.php",
            "line":113,
            "function":"__invoke",
            "class":"GuzzleHttp\\Handler\\CurlHandler",
            "type":"->",
            "args":[
               "*** sensitive parameter replaced ***",
               "*** sensitive parameter replaced ***"
            ]
         },
         {
            "file":"/app/3rdparty/guzzlehttp/guzzle/src/PrepareBodyMiddleware.php",
            "line":35,
            "function":"OC\\Http\\Client\\{closure}",
            "class":"OC\\Http\\Client\\DnsPinMiddleware",
            "type":"->",
            "args":[
               "*** sensitive parameters replaced ***"
            ]
         },
         {
            "file":"/app/3rdparty/guzzlehttp/guzzle/src/Middleware.php",
            "line":31,
            "function":"__invoke",
            "class":"GuzzleHttp\\PrepareBodyMiddleware",
            "type":"->",
            "args":[
               "*** sensitive parameter replaced ***",
               "*** sensitive parameter replaced ***"
            ]
         },
         {
            "file":"/app/3rdparty/guzzlehttp/guzzle/src/RedirectMiddleware.php",
            "line":71,
            "function":"GuzzleHttp\\{closure}",
            "class":"GuzzleHttp\\Middleware",
            "type":"::",
            "args":[
               "*** sensitive parameters replaced ***"
            ]
         },
         {
            "file":"/app/3rdparty/guzzlehttp/guzzle/src/Middleware.php",
            "line":63,
            "function":"__invoke",
            "class":"GuzzleHttp\\RedirectMiddleware",
            "type":"->",
            "args":[
               "*** sensitive parameter replaced ***",
               "*** sensitive parameter replaced ***"
            ]
         },
         {
            "file":"/app/3rdparty/guzzlehttp/guzzle/src/HandlerStack.php",
            "line":75,
            "function":"GuzzleHttp\\{closure}",
            "class":"GuzzleHttp\\Middleware",
            "type":"::",
            "args":[
               "*** sensitive parameters replaced ***"
            ]
         },
         {
            "file":"/app/3rdparty/guzzlehttp/guzzle/src/Client.php",
            "line":331,
            "function":"__invoke",
            "class":"GuzzleHttp\\HandlerStack",
            "type":"->",
            "args":[
               "*** sensitive parameter replaced ***",
               "*** sensitive parameter replaced ***"
            ]
         },
         {
            "file":"/app/3rdparty/guzzlehttp/guzzle/src/Client.php",
            "line":168,
            "function":"transfer",
            "class":"GuzzleHttp\\Client",
            "type":"->",
            "args":[
               "*** sensitive parameter replaced ***",
               "*** sensitive parameter replaced ***"
            ]
         },
         {
            "file":"/app/3rdparty/guzzlehttp/guzzle/src/Client.php",
            "line":187,
            "function":"requestAsync",
            "class":"GuzzleHttp\\Client",
            "type":"->",
            "args":[
               "get",
               {
                  "__class__":"GuzzleHttp\\Psr7\\Uri"
               },
               {
                  "0":"And 6 more entries, set log level to debug to see all entries",
                  "verify":false,
                  "timeout":45,
                  "nextcloud":{
                     "allow_local_address":true
                  },
                  "synchronous":true,
                  "handler":{
                     "__class__":"GuzzleHttp\\HandlerStack"
                  }
               }
            ]
         },
         {
            "file":"/app/lib/private/Http/Client/Client.php",
            "line":223,
            "function":"request",
            "class":"GuzzleHttp\\Client",
            "type":"->",
            "args":[
               "get",
               "https://example.com/apps/richdocumentscode/proxy.php?req=/hosting/discovery",
               {
                  "verify":false,
                  "timeout":45,
                  "nextcloud":{
                     "allow_local_address":true
                  },
                  "headers":{
                     "User-Agent":"Nextcloud Server Crawler",
                     "Accept-Encoding":"gzip"
                  },
                  "synchronous":true
               }
            ]
         },
         {
            "file":"/app/apps/richdocuments/lib/WOPI/DiscoveryManager.php",
            "line":84,
            "function":"get",
            "class":"OC\\Http\\Client\\Client",
            "type":"->",
            "args":[
               "https://example.com/apps/richdocumentscode/proxy.php?req=/hosting/discovery",
               {
                  "timeout":45,
                  "nextcloud":{
                     "allow_local_address":true
                  },
                  "verify":false
               }
            ]
         },
         {
            "file":"/app/apps/richdocuments/lib/WOPI/DiscoveryManager.php",
            "line":56,
            "function":"fetchFromRemote",
            "class":"OCA\\Richdocuments\\WOPI\\DiscoveryManager",
            "type":"->",
            "args":[

            ]
         },
         {
            "file":"/app/apps/richdocuments/lib/WOPI/Parser.php",
            "line":41,
            "function":"get",
            "class":"OCA\\Richdocuments\\WOPI\\DiscoveryManager",
            "type":"->",
            "args":[

            ]
         },
         {
            "file":"/app/apps/richdocuments/lib/TokenManager.php",
            "line":202,
            "function":"getUrlSrc",
            "class":"OCA\\Richdocuments\\WOPI\\Parser",
            "type":"->",
            "args":[
               "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
            ]
         },
         {
            "file":"/app/apps/richdocuments/lib/Controller/DocumentController.php",
            "line":222,
            "function":"getToken",
            "class":"OCA\\Richdocuments\\TokenManager",
            "type":"->",
            "args":[
               "*** sensitive parameters replaced ***"
            ]
         },
         {
            "file":"/app/lib/private/AppFramework/Http/Dispatcher.php",
            "line":217,
            "function":"index",
            "class":"OCA\\Richdocuments\\Controller\\DocumentController",
            "type":"->",
            "args":[
               "*** sensitive parameter replaced ***",
               null
            ]
         },
         {
            "file":"/app/lib/private/AppFramework/Http/Dispatcher.php",
            "line":126,
            "function":"executeController",
            "class":"OC\\AppFramework\\Http\\Dispatcher",
            "type":"->",
            "args":[
               {
                  "__class__":"OCA\\Richdocuments\\Controller\\DocumentController"
               },
               "index"
            ]
         },
         {
            "file":"/app/lib/private/AppFramework/App.php",
            "line":156,
            "function":"dispatch",
            "class":"OC\\AppFramework\\Http\\Dispatcher",
            "type":"->",
            "args":[
               {
                  "__class__":"OCA\\Richdocuments\\Controller\\DocumentController"
               },
               "index"
            ]
         },
         {
            "file":"/app/lib/private/Route/Router.php",
            "line":302,
            "function":"main",
            "class":"OC\\AppFramework\\App",
            "type":"::",
            "args":[
               "OCA\\Richdocuments\\Controller\\DocumentController",
               "index",
               {
                  "__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"
               },
               {
                  "_route":"richdocuments.document.index"
               }
            ]
         },
         {
            "file":"/app/lib/base.php",
            "line":1006,
            "function":"match",
            "class":"OC\\Route\\Router",
            "type":"->",
            "args":[
               "/apps/richdocuments/index"
            ]
         },
         {
            "file":"/app/index.php",
            "line":36,
            "function":"handleRequest",
            "class":"OC",
            "type":"::",
            "args":[

            ]
         }
      ],
      "File":"/app/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php",
      "Line":210,
      "CustomMessage":"--"
   },
   "id":"619f5f0421a9d"
}
dletozeun commented 2 years ago

Edit: AND, apparently if I comment out lines 147 and 148 of the app's proxy.php file (the part returning the error) and try to edit a document it works fine.

Thanks @Magicrafter13 for pointing me in the right direction. I was getting a similar error and checking the php error logs, I found out this error was causing the connection issue:

richdocumentscode (proxy.php) error exit, PID: 253864, Message: no_fontconfig

Commenting the error check (see below) fixed the problem although I have no idea what would be a proper fix as it probably has some side effects.

`exec('(` /sbin/ldconfig -p || scanelf -l ) | grep fontconfig > /dev/null 2>&1', $output, $return);
//    if ($return)
//        return 'no_fontconfig';
rschr commented 2 years ago

The no_fontconfig problem discussed here starting with https://github.com/CollaboraOnline/richdocumentscode/issues/145#issuecomment-955610421 doesn't seem to be quite the same as the problem originally reported in this issue #145.

On my servers, the problem doesn't go away with commenting out the no_fontconfig related error check.

Now that the CODE server version number scheme has changed, going from 6.4.1103 (last good one) over 6.4.1303, then 21.11.4, to 21.11.6. with the latter being the current one at this point, the problem is still there. (And for anyone wanting to try the commenting-out approach mentioned, those two lines now are 151 and 152.)

pktiuk commented 2 years ago

In my case I was firstly getting message

image

But after refreshing site I got

image

And when I tried to open tab Built-in CODE server

image

My server stopped responding. After this I had to restart entire docker container with my nextcloud. :disappointed:

sijanec commented 2 years ago

Regarding no_fontconfig issue: Detecting a library like that (with /sbin/ldconfig) should in my humble opinion be avoided. In my chrooted setup where I run nextcloud, there are no suid binaries and there is no /etc/ld.so.cache, so ldconfig -p always fails. If you are running in a chroot with nosuid, this may be the issue.