nextcloud / richdocuments

📑 Collabora Online for Nextcloud
https://nextcloud.com/collaboraonline
349 stars 115 forks source link

Cannot open documents: "Document loading failed" #3906

Open DaanSelen opened 1 month ago

DaanSelen commented 1 month ago

Describe the bug After working fine for a long time, it suddenly does not work anymore with this screenshot after a short while of waiting: image I repulled the latest images for both nextcloud and collabora/code. But still this issue persists.

To Reproduce Unknown

Expected behavior Documents to open and function normally.

Screenshots

frk-00028-00028 2024-08-14 15:23:35.982168 +0200 [ forkit ] WRN  The systemplate directory [/opt/cool/systemplate] is read-only, and at least [/opt/cool/systemplate//etc/hosts] is out-of-date. Will have to copy sysTemplate to jails. To restore optimal performance, make sure the files in [/opt/cool/systemplate/etc] are up-to-date.| common/JailUtil.cpp:555
wsd-00001-00102 2024-08-14 15:25:44.351204 +0200 [ docbroker_008 ] ERR  Doc [https%3A%2F%2Fcloud.nerthus.nl%3A443%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F43846_ocem17pa817x] is taking too long to load. Will kill process [89]. per_document.limit_load_secs set to 100 secs.| wsd/DocumentBroker.cpp:415
wsd-00001-00102 2024-08-14 15:25:44.363909 +0200 [ docbroker_008 ] ERR  #57: Read failed, have 0 buffered bytes (ECONNRESET: Connection reset by peer)| net/Socket.hpp:1149
wsd-00001-00102 2024-08-14 15:25:44.363988 +0200 [ docbroker_008 ] WRN  #57: Unassociated Kit (89) disconnected unexpectedly| wsd/COOLWSD.cpp:3699
wsd-00001-00102 2024-08-14 15:25:44.363999 +0200 [ docbroker_008 ] WRN  #57: Unknown Kit process closed with pid -1| wsd/COOLWSD.cpp:3706
sh: 1: /usr/bin/coolmount: Operation not permitted
sh: 1: /usr/bin/coolmount: Operation not permitted
sh: 1: /usr/bin/coolmount: Operation not permitted

image

The admin panel is also reachable fine, and the nextcloud instance can also reach collabora with the OK.

root@nextcloud-deploy-nextcloud-54dc8857dd-7wbd8:/config/www/nextcloud/apps# curl -L collabora.domain.com
OK

Client details:

Server details

Operating system: Kubernetes on Linux Web server: NGINX Database: Postgresql PHP version: Latest? Nextcloud version: image

Version of the richdocuments app 8.4.4 Version of Collabora Online image

Configuration of the richdocuments app

{
    "apps": {
        "richdocuments": {
            "installed_version": "8.4.4",
            "enabled": "yes",
            "types": "prevent_group_restriction",
            "disable_certificate_verification": "",
            "wopi_allowlist": "0.0.0.0\/0",
            "wopi_url": "https:\/\/collabora.domain.com",
            "public_wopi_url": "https:\/\/collabora.domain.com"
        }
    }
}

Nextcloud log (data/nextcloud.log)

No new log entries on trying to reproduce
DaanSelen commented 1 month ago

To add to this, I tried another instance that is connected to the same collabora instance but runs on the same docker daemon as collabora itself, and it receives the same issue.

joshtrichards commented 3 weeks ago

The error suggests that your Collabora container isn't able to reach the Nextcloud one:

ERR Doc [https%3A%2F%2Fcloud.nerthus.nl%3A443%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F43846_ocem17pa817x] is taking too long to load

So try the curl tests from that container and using the NC URL.

DaanSelen commented 3 weeks ago

The error suggests that your Collabora container isn't able to reach the Nextcloud one:

ERR Doc [https%3A%2F%2Fcloud.nerthus.nl%3A443%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F43846_ocem17pa817x] is taking too long to load

So try the curl tests from that container and using the NC URL.

Thanks for the feedback, for now this is the response when curling the Nextcloud instance:

cool@af82fcc6eb8d:/$ curl cloud.nerthus.nl
<html>
<head><title>301 Moved Permanently</title></head>
<body>
<center><h1>301 Moved Permanently</h1></center>
<hr><center>openresty</center>
</body>
</html>
cool@af82fcc6eb8d:/$ curl cloud.nerthus.nl -L
<!DOCTYPE html>
<html class="ng-csp" data-placeholder-focus="false" lang="en" data-locale="en" translate="no">
<head data-requesttoken="LopOxP60M0yBQYqL2FNzfNrlxhD6CQTMpVVifvVWuzs=:Z8YUiajDcCTYC8CyoColMq/dhHjPQjGblRcuR5cM3W8=">
<meta charset="utf-8">
<title>
                        Login – Nerthus Cloud           </title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<meta name="apple-itunes-app" content="app-id=1125420102">
<meta name="theme-color" content="#8855a8">
<link rel="icon" href="/apps/theming/favicon?v=fe5dbbce">
<link rel="apple-touch-icon" href="/apps/theming/icon?v=fe5dbbce">
<link rel="mask-icon" sizes="any" href="/core/img/favicon-mask.svg" color="#8855a8">
<link rel="manifest" href="/apps/theming/manifest?v=fe5dbbce" crossorigin="use-credentials">
<link rel="stylesheet" href="/core/css/server.css?v=cc80af1d-8">
<link rel="stylesheet" href="/apps/theming/css/default.css?v=0d6d4ea2-8">
<link rel="stylesheet" href="/core/
...

So it looks like it is able to reach it.

gpolydoros commented 3 weeks ago

I have the same problem.

Both Nextcloud and Collabora are running as Docker containers, are accessible from the outside via NPM with valid certs etc. WOPI settings are also configured correctly. I really haven't changed anything at all and it used to work just fine for a long time until recently.

Don't know if it's because of the last update of Nextcloud Office or the latest upgrade to Nextcloud 29.0.5, but now I get the same error as reported by Daan.

From my browser's dev tools it looks like something is timing out ("Document loading failed due to timeout: Please check for failing network requests"), but the only GET requests failing are a few images that are blocked due to content security policy.

DaanSelen commented 3 weeks ago

Issue is still present with version 8.4.5.

gpolydoros commented 3 weeks ago

For me as well, just tried 8.4.5 and the problem still exists.

Lennyz1988 commented 3 weeks ago

Same issue here. Timeout and getting an error about Content-Security-Policy. (frame-ancestors) op blocked, because it's in error with the following instruction: ‘frame-ancestors 'self'’

DaanSelen commented 3 weeks ago

Same issue here. Timeout and getting an error about Content-Security-Policy. (frame-ancestors) op blocked, because it's in error with the following instruction: ‘frame-ancestors 'self'’

Can you post the log?

gpolydoros commented 3 weeks ago

Here is mine if it helps (edited to replace any personal info):

File info for /Documents/REDACTED.odt fetched Object { filename: Getter & Setter, basename: Getter & Setter, lastmod: Getter & Setter, size: Getter & Setter, type: Getter & Setter, etag: Getter & Setter, mime: Getter & Setter, tags: Getter & Setter, getcontentlength: Getter & Setter, getcontenttype: Getter & Setter, … } viewer-main.mjs:24491:17 Feature Policy: Skipping unsupported feature name “clipboard-read”. viewer-main.mjs:4957:8 Feature Policy: Skipping unsupported feature name “clipboard-write”. viewer-main.mjs:4957:8 Feature Policy: Skipping unsupported feature name “clipboard-read”. viewer-main.mjs:4159:15 Feature Policy: Skipping unsupported feature name “clipboard-write”. viewer-main.mjs:4159:15 [getWopiUrl] https://nextcloud.domain.com/index.php/apps/richdocuments/wopi/files/13249_ocnwqktt7pdx url.js:44:9 Content-Security-Policy warnings 4 This page uses the non standard property “zoom”. Consider using calc() in the relevant property values, or using “transform” along with “transform-origin: 0 0”. cool.html Content-Security-Policy: The page’s settings blocked the loading of a resource (connect-src) at wss://collabora/.domain/.com/cool/https%3A%2F%2Fnextcloud.domain.com%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F13249_ocnwqktt7pdx%3Faccess_token%3REDACTED%26access_token_ttl%3D0/ws?WOPISrc=https%3A%2F%2Fnextcloud.domain.com%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F13249_ocnwqktt7pdx&compat=/ws because it violates the following directive: “connect-src 'self' https://www.zotero.org https://api.zotero.org” global.js:1:29861 Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience. For more help https://xhr.spec.whatwg.org/#sync-warning bundle.js:8812:5 [viewer] Received post message App_LoadingStatus Object { Status: "Initialized" } false Office.vue:384 Content-Security-Policy: The page’s settings blocked the loading of a resource (img-src) at https://collabora/.domain/.com/browser/4fd2181/images/lc_searchprev.svg because it violates the following directive: “img-src 'self' data: https://www.collaboraoffice.com https://nextcloud.domain.com:” bundle.js:9639:71 Content-Security-Policy: The page’s settings blocked the loading of a resource (img-src) at https://collabora/.domain/.com/browser/4fd2181/images/lc_searchnext.svg because it violates the following directive: “img-src 'self' data: https://www.collaboraoffice.com https://nextcloud.domain.com:” bundle.js:9639:71 Content-Security-Policy: The page’s settings blocked the loading of a resource (img-src) at https://collabora/.domain/.com/browser/4fd2181/images/lc_cancel.svg because it violates the following directive: “img-src 'self' data: https://www.collaboraoffice.com https://nextcloud.domain.com:” bundle.js:9639:71 Content-Security-Policy: The page’s settings blocked the loading of a resource (img-src) at https://collabora/.domain/.com/browser/4fd2181/images/lc_languagemenu.svg because it violates the following directive: “img-src 'self' data: https://www.collaboraoffice.com https://nextcloud.domain.com:” bundle.js:9639:71 Content-Security-Policy: The page’s settings blocked the loading of a resource (img-src) at https://collabora/.domain/.com/browser/4fd2181/images/lc_signature.svg because it violates the following directive: “img-src 'self' data: https://www.collaboraoffice.com https://nextcloud.domain.com:” bundle.js:9639:71 Content-Security-Policy: The page’s settings blocked the loading of a resource (img-src) at https://collabora/.domain/.com/browser/4fd2181/images/lc_prev.svg because it violates the following directive: “img-src 'self' data: https://www.collaboraoffice.com https://nextcloud.domain.com:” bundle.js:9639:71 Content-Security-Policy: The page’s settings blocked the loading of a resource (img-src) at https://collabora/.domain/.com/browser/4fd2181/images/lc_next.svg because it violates the following directive: “img-src 'self' data: https://www.collaboraoffice.com https://nextcloud.domain.com:” bundle.js:9639:71 Content-Security-Policy: The page’s settings blocked the loading of a resource (img-src) at https://collabora/.domain/.com/browser/4fd2181/images/zoomreset.svg because it violates the following directive: “img-src 'self' data: https://www.collaboraoffice.com https://nextcloud.domain.com:” bundle.js:9639:71 Content-Security-Policy: The page’s settings blocked the loading of a resource (img-src) at https://collabora/.domain/.com/browser/4fd2181/images/minus.svg because it violates the following directive: “img-src 'self' data: https://www.collaboraoffice.com https://nextcloud.domain.com:” bundle.js:9639:71 Content-Security-Policy: The page’s settings blocked the loading of a resource (img-src) at https://collabora/.domain/.com/browser/4fd2181/images/plus.svg because it violates the following directive: “img-src 'self' data: https://www.collaboraoffice.com https://nextcloud.domain.com:” bundle.js:9639:71 Content-Security-Policy: The page’s settings blocked the loading of a resource (connect-src) at wss://collabora/.domain/.com/cool/https%3A%2F%2Fnextcloud.domain.com%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F13249_ocnwqktt7pdx%3Faccess_token%3REDACTED%26access_token_ttl%3D0%26permission%3Dedit/ws?WOPISrc=https%3A%2F%2Fnextcloud.domain.com%2Findex.php%2Fapps%2Frichdocuments%2Fwopi%2Ffiles%2F13249_ocnwqktt7pdx&compat=/ws because it violates the following directive: “connect-src 'self' https://www.zotero.org https://api.zotero.org” global.js:1:29861 Document loading failed due to timeout: Please check for failing network requests Office.vue:343

DaanSelen commented 3 weeks ago

@gpolydoros I do not know if it is the same issue, we see some kind of timeout, which I do not see in your error log. But welcome.

Lennyz1988 commented 3 weeks ago

Setup:

Nextcloud docker running behind Nginx reverse proxy. Collabora office docker running behind Nginx reverse proxy.

Both containers can talk to each other.

No error logs in Collabora docker container.

Chrome / Firefox log when opening a file:

ConsoleLogger.js:74 [ERROR] text: Unexpected Error "Failed to apply steps. Retry!" Object value @ ConsoleLogger.js:74 viewer-main.mjs?v=b5455272-0:44 [INFO] viewer: Opening viewer for file Object Refused to frame 'https://office.mydomain.nl/' because an ancestor violates the following Content Security Policy directive: "frame-ancestors 'self'". NcButton.mjs:175 You need to fill either the text or the ariaLabel props in the button component. Object o render @ NcButton.mjs:175 NcButton.mjs:175 You need to fill either the text or the ariaLabel props in the button component. Object o render @ NcButton.mjs:175 2035778:1 Refused to apply style from 'https://office.mydomain.nl/apps/libresign/css/icons.css?v=955f830b-0' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled. Office.vue:338 Document loading failed due to timeout: Please check for failing network requests

No errors in

DaanSelen commented 3 weeks ago

Ah I see, I said nothing. Hopefully it will be picked up by the Nextcloud/Collabora maintainers

gpolydoros commented 3 weeks ago

@gpolydoros I do not know if it is the same issue, we see some kind of timeout, which I do not see in your error log. But welcome.

I do get a timeout error actually, "Document loading failed due to timeout: Please check for failing network requests". It's the last line in my log export :)

Can't tell if its the same issue or not though - all I know is that it worked fine until very recently, and now suddenly it's not.

I am running Docker on Debian with Nextcloud and Collabora as containers on the same machine.

DaanSelen commented 3 weeks ago

I think we all suffer the same bug.

gpolydoros commented 3 weeks ago

OK, looking at my own logs again more carefully, I noticed that the requested URL is actually collabora/.domain/.com/, with a slash before every dot. These slashes certainly shouldn't be there.

I remember that when setting up my Collabora docker instance, it required a few environment variables to work, namely server_name and aliasgroup1, with server_name being my Collabora URL and aliasgroup1 being my Nextcloud URL.

Both URLs needed to be escaped accordingly in order to work (i.e. nextcloud[\].domain[\].com and collabora[\].domain[\].com).

This had worked fine until very recently, but now (maybe after a Collabora update - I don't really know as I use watchtower to handle Docker image updates automatically) it appears that those backslashes are instead converted to forward slashes, resulting in something like i.e. collabora[/].domain[/].com.

So, I decided to remove the backslashes from both environment variables in my Docker compose file just to test my theory and, to my surprise, Nextcloud now loads the documents correctly.

DaanSelen commented 3 weeks ago

OK, looking at my own logs again more carefully, I noticed that the requested URL is actually collabora/.domain/.com/, with a slash before every dot. These slashes certainly shouldn't be there.

I remember that when setting up my Collabora docker instance, it required a few environment variables to work, namely server_name and aliasgroup1, with server_name being my Collabora URL and aliasgroup1 being my Nextcloud URL.

Both URLs needed to be escaped accordingly in order to work (i.e. nextcloud[].domain[].com and collabora[].domain[].com).

This had worked fine until very recently, but now (maybe after a Collabora update - I don't really know as I use watchtower to handle Docker image updates automatically) it appears that those backslashes are instead converted to forward slashes, resulting in something like i.e. collabora[/].domain[/].com.

So, I decided to remove the backslashes from both environment variables in my Docker compose file just to test my theory and, to my surprise, Nextcloud now loads the documents correctly.

Can confirm, this does fix the issue! My document loads again!

gpolydoros commented 3 weeks ago

OK, looking at my own logs again more carefully, I noticed that the requested URL is actually collabora/.domain/.com/, with a slash before every dot. These slashes certainly shouldn't be there. I remember that when setting up my Collabora docker instance, it required a few environment variables to work, namely server_name and aliasgroup1, with server_name being my Collabora URL and aliasgroup1 being my Nextcloud URL. Both URLs needed to be escaped accordingly in order to work (i.e. nextcloud[].domain[].com and collabora[].domain[].com). This had worked fine until very recently, but now (maybe after a Collabora update - I don't really know as I use watchtower to handle Docker image updates automatically) it appears that those backslashes are instead converted to forward slashes, resulting in something like i.e. collabora[/].domain[/].com. So, I decided to remove the backslashes from both environment variables in my Docker compose file just to test my theory and, to my surprise, Nextcloud now loads the documents correctly.

Can confirm, this does fix the issue! My document loads again!

Nice to know and glad I helped!

This actually confirms that something has indeed changed in the way the Collabora container parses its environment variables.

Last CODE update was 3 days ago, so this is most probably when this change was introduced.

Lennyz1988 commented 3 weeks ago

Can you guys post your docker config?