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 find urlsrc in WOPI #119

Open chrissooo opened 3 years ago

chrissooo commented 3 years ago

Hi,

have Update to 6.4.705 an have a error when try to open a document:

I am on a CentOS 7 installation, PHP 8 and Apache. No Docker Image.

[richdocuments] Error: Exception: Could not find urlsrc in WOPI at <<closure>>

0. ******/apps/richdocuments/lib/TokenManager.php line 217
   OCA\Richdocuments\WOPI\Parser->getUrlSrc("application/vnd ... t")
1. ******/apps/richdocuments/lib/Controller/DocumentController.php line 256
   OCA\Richdocuments\TokenManager->getToken("*** sensitive parameters replaced ***")
2. ******/lib/private/AppFramework/Http/Dispatcher.php line 218
   OCA\Richdocuments\Controller\DocumentController->index("*** sensitive parameter replaced ***", null)
3. ******/lib/private/AppFramework/Http/Dispatcher.php line 127
   OC\AppFramework\Http\Dispatcher->executeController(OCA\Richdocument ... {}, "index")
4. ******/lib/private/AppFramework/App.php line 157
   OC\AppFramework\Http\Dispatcher->dispatch(OCA\Richdocument ... {}, "index")
5. ******/lib/private/Route/Router.php line 302
   OC\AppFramework\App::main("OCA\\Richdocume ... r", "index", OC\AppFramework\ ... {}, {_route: "richdocuments.document.index"})
6. ******/lib/base.php line 993
   OC\Route\Router->match("/apps/richdocuments/index")
7. ******/index.php line 37
   OC::handleRequest()

GET /apps/richdocuments/index?fileId=19121&requesttoken=jRd3y0CoWLcTBxakWricr3nu%2FiSZLT0S23weF5TaFSY%3D%3Apjg2nBfyKJhqdlXDIt391S2evFb%2FGFRrlTRpb9uLbVU%3D

Manual Downgrade to 6.4.608 Fixed it.

fpennica commented 2 years ago

this is mine, and it works for me:

Ok, thanks! Tried the same but the problem is still there. There must be something else...

Are you using Let's Encrypt? (activated with nextcloud.enable-https lets-encrypt)

estebanlm commented 2 years ago

Yes, for me almost nothing was working before I activated lets-encrypt. It may be that, but I really don't know... I feel like punching something with the eyes closed ;)

On Jan 31 2022, at 10:05 am, Francesco Pennica @.***> wrote:

this is mine, and it works for me: Ok, thanks! Tried the same but the problem is still there. There must be something else...

Are you using Let's Encrypt? (activated with nextcloud.enable-https lets-encrypt) — Reply to this email directly, view it on GitHub (https://github.com/CollaboraOnline/richdocumentscode/issues/119#issuecomment-1025515666), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAD5MXX2NJPARUAHA4MXE53UYZGFHANCNFSM4ZU27B7A). Triage notifications on the go with GitHub Mobile for iOS (https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675) or Android (https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub). You are receiving this because you commented.

fpennica commented 2 years ago

Ok, I got it working!

Turns out, adding the line RequestHeader set X-Forwarded-Proto https had nothing to do with my problem, it was instead a problem with fontconfig not configured on my Ubuntu Server 20.04.

The url https://<my.domain.address>/extra-apps/richdocumentscode/proxy.php?status was responding with a no_fontconfig error, so I tried to install a bunch of packages to pull in some fontconfig dependencies (I don't know exactly which are the correct ones):

sudo apt install fontconfig-config build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

After installing the libraries the proxy responds with {"status":"OK"} and everything works as expected.

The no_fontconfig error is also mentioned in #162 and #145

Probably the error message in Nextcloud logs Could not find urlsrc in WOPI was misleading in this case, it should have returned the real proxy error no_fontconfig.

maurerle commented 1 year ago

I get Could not find urlsrc in WOPI on my nextcloud install using built-in code server, when trying to open a document. This started since updating to 2023.05 version I think, I am running nextcloud 27.0

proxy.php?status shows Ok and I am using the nginx configuration from here: https://docs.nextcloud.com/server/latest/admin_manual/installation/nginx.html#nextcloud-in-the-webroot-of-nginx

Any help is appriciated!

When trying to load the file in the browser i get a server error 500 for the following request: https://cloud.examplecom/apps/richdocuments/index?fileId=10549&requesttoken=xxx&path=/example.docx

maurerle commented 1 year ago

I did let the system run for a day and now it works - I did not change anything. So it either might be caching related or the collabora service was not started completely which caused it to issue the 500 Server error :shrug:

R0Wi commented 1 year ago

Indeed the problem seems to be related to some caching inside of the Nextcloud infrastructure. In my case the WOPI discovery went wrong for some reasons here with the following server response:

<html><body>
<h1>Socket proxy error</h1>
<p>Error: Timed out opening local socket: 99 - Cannot assign requested address</p>
</body></html>

I was only able to figure that out by adding appropriate logging to the mentioned line of code.

$this->logger->debug('discovery: {discovery}', ['discovery' => $discovery]);

It seems that this faulty response is cached for 1 hour in the Nextcloud cache. So I commented out this line to force the NC app to always fetch a fresh server response for the discovery. Now it seems to work.

Unfortunately I'm not able to tell where this error response was coming from or why it happend but in my case it was clearly a problem in combination with the Nextcloud infrastructure, which caches the error response. Hope this helps!