Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Office Online integration app becoming disabled #463

Open
s7thamon opened this issue Jul 25, 2023 · 16 comments
Open

Office Online integration app becoming disabled #463

s7thamon opened this issue Jul 25, 2023 · 16 comments

Comments

@s7thamon
Copy link

s7thamon commented Jul 25, 2023

Describe the bug
Utilizing Nextcloud AIO without collabra and the Office Online integration app installed. After a few days, seemingly at random, the app will become disabled and users will not be able to open office files. Logging back in and enabling the app again resolves the issue.

Screenshots
Becomes disabled:
image

Server details

Operating system: Ubuntu, 8GB RAM

Nextcloud version:
Nextcloud AIO v6.2.1

Version of the officeonline app
Office Online integration 2.0.2

Logs

Nextcloud log (data/nextcloud.log)

Error | index | Exception: Call  to a member function getFileid() on null in file  '/var/www/html/custom_apps/officeonline/lib/Middleware/WOPIMiddleware.php'  line 77 |  

2023-07-24T08:22:33-0400
@sergeyadamenko
Copy link

we have same issue...

@Novarchibald
Copy link

Same here

@juliusknorr
Copy link
Member

Can you paste the full raw json error message from the logs? That should contain more details on where this originates from exactly

@dertorsten
Copy link

Hello,
still present with Nextcloud 27.1.3.3

appdisabled.json

@Orchal
Copy link

Orchal commented Jan 12, 2024

Hi,

we have this issue since the update to NC 28.0.1.
Here the json log:

{"reqId":"IHRYd64MKJsyP34CJX5N","level":3,"time":"2024-01-12T11:56:28+00:00","remoteAddr":"xxx.xxx.xxx.xxx","user":"xxxxxxxx","app":"no app in context","method":"GET","url":"/index.php/apps/files","message":"App officeonline threw an error during app.php load and will be disabled: Call to undefined method O C\Server::getEventDispatcher()","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36","version":"28.0.1.1","exception":{"Exception":"Error","Message":"Call to undefined method OC\Server::getEventDispatcher()","Code":0,"Trace":[{"file":"/var /www/nextcloud/lib/private/App/AppManager.php","line":522,"function":"require_once"},{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":413,"function":"requireAppFile","class":"OC\App\AppManager","type":"::"},{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":213,"funct ion":"loadApp","class":"OC\App\AppManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":125,"function":"loadApps","class":"OC\App\AppManager","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/AppInfo/Application.php","line":218,"function":"loadApps","class":"OC_ App","type":"::"},{"file":"/var/www/nextcloud/lib/private/AppFramework/Bootstrap/Coordinator.php","line":200,"function":"boot","class":"OCA\DAV\AppInfo\Application","type":"->"},{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":434,"function":"bootApp","class":"OC\AppFramework\Boot strap\Coordinator","type":"->"},{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":213,"function":"loadApp","class":"OC\App\AppManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":125,"function":"loadApps","class":"OC\App\AppManager","type":"->"},{ "file":"/var/www/nextcloud/lib/private/legacy/OC_User.php","line":237,"function":"loadApps","class":"OC_App","type":"::"},{"file":"/var/www/nextcloud/apps/user_saml/appinfo/app.php","line":88,"function":"handleApacheAuth","class":"OC_User","type":"::"},{"file":"/var/www/nextcloud/lib/private/App/AppMana ger.php","line":522,"args":["/var/www/nextcloud/apps/user_saml/appinfo/app.php"],"function":"require_once"},{"file":"/var/www/nextcloud/lib/private/App/AppManager.php","line":413,"function":"requireAppFile","class":"OC\App\AppManager","type":"::"},{"file":"/var/www/nextcloud/lib/private/App/AppManager .php","line":213,"function":"loadApp","class":"OC\App\AppManager","type":"->"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_App.php","line":125,"function":"loadApps","class":"OC\App\AppManager","type":"->"},{"file":"/var/www/nextcloud/lib/base.php","line":1041,"function":"loadApps","class":"OC_ App","type":"::"},{"file":"/var/www/nextcloud/index.php","line":39,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/nextcloud/apps/officeonline/appinfo/app.php","Line":36,"message":"App officeonline threw an error during app.php load and will be disabled: Call to undefined method O C\Server::getEventDispatcher()","exception":{},"CustomMessage":"App officeonline threw an error during app.php load and will be disabled: Call to undefined method OC\Server::getEventDispatcher()"}}

I think it's related to things described here: https://help.nextcloud.com/t/symfony-event-dispatcher-update-in-nextcloud-server-28-breaking-changes/167550

Thank you

@Orchal
Copy link

Orchal commented Jan 12, 2024

It's documented in the upgrade notes, here the pull request: nextcloud/server#38546
Upgrade notes: https://docs.nextcloud.com/server/28/developer_manual/app_publishing_maintenance/app_upgrade_guide/upgrade_to_28.html

@Orchal
Copy link

Orchal commented Jan 12, 2024

I made two changes, and it seems to work, but I have no idea what I'm doing... So it might be pretty stupid or what... I just hope it will help:

  • [...]/apps/officeonline/appinfo/app.php : changed $eventDispatcher = \OC::$server->getEventDispatcher(); => $eventDispatcher = \OC::$server->get(IEventDispatcher::class); and added use OCP\EventDispatcher\IEventDispatcher;
  • comment line 267 in [...]/apps/officeonline/lib/Controller/DocumentController.php

@nicovd737
Copy link

Hello,
Any news about this issue ? We have upgraded to NC 28 and office only is unasable for all our users.
Thanks
Nico

@nicovd737
Copy link

  • use OCP\EventDispatcher\IEventDispatcher;

Thanks but not working for me.

@Dennis1993
Copy link
Contributor

Dennis1993 commented Jan 19, 2024

Here is a fix but it isn't published yet @juliushaertl :(

I hope the release is coming soon because no update to 28 is possible at the moment.

#490 (comment)

@nicovd737
Copy link

Here is a fix but it isn't published yet @juliushaertl :(

I hope the release is coming soon because no update to 28 is possible at the moment.

#490 (comment)

Hello,

Thanks a lot ! Great Job ! It solved my issue :-)

@justkrevedko
Copy link

justkrevedko commented Jan 20, 2024

Here is a fix but it isn't published yet @juliushaertl :(

I hope the release is coming soon because no update to 28 is possible at the moment.

#490 (comment)

Hello.

This fix solves the application startup issue, but there is an issue with ms edge that appears to be CSP related.
When opening the document in the browser console there is the error "Refused to execute inline script because it violates the following Content Security Policy directive" and then 404 showing "Page not found on server".
In web-server nginx logs there is a line "/apps/officeonline/undefinedWOPISrc=nextcloud/index.php%2Fapps%2Fofficeonline%2Fwopi%2Ffiles%2Fundefined&title=undefined&lang=en&closebutton=1&revisionhistory=1"
The problem is only reproduced in MS Edge, in Chrome and Firefox the editor just works.

@Dennis1993
Copy link
Contributor

Another guy asked the same question: https://help.nextcloud.com/t/office-online-integration-and-nextcloud-28-0-1/179431

@plusls
Copy link

plusls commented Mar 8, 2024

Here is a fix but it isn't published yet @juliushaertl :(
I hope the release is coming soon because no update to 28 is possible at the moment.
#490 (comment)

Hello.

This fix solves the application startup issue, but there is an issue with ms edge that appears to be CSP related. When opening the document in the browser console there is the error "Refused to execute inline script because it violates the following Content Security Policy directive" and then 404 showing "Page not found on server". In web-server nginx logs there is a line "/apps/officeonline/undefinedWOPISrc=nextcloud/index.php%2Fapps%2Fofficeonline%2Fwopi%2Ffiles%2Fundefined&title=undefined&lang=en&closebutton=1&revisionhistory=1" The problem is only reproduced in MS Edge, in Chrome and Firefox the editor just works.

Any progress?

@plusls
Copy link

plusls commented Mar 17, 2024

Here is a fix but it isn't published yet @juliushaertl :(
I hope the release is coming soon because no update to 28 is possible at the moment.
#490 (comment)

Hello.

This fix solves the application startup issue, but there is an issue with ms edge that appears to be CSP related. When opening the document in the browser console there is the error "Refused to execute inline script because it violates the following Content Security Policy directive" and then 404 showing "Page not found on server". In web-server nginx logs there is a line "/apps/officeonline/undefinedWOPISrc=nextcloud/index.php%2Fapps%2Fofficeonline%2Fwopi%2Ffiles%2Fundefined&title=undefined&lang=en&closebutton=1&revisionhistory=1" The problem is only reproduced in MS Edge, in Chrome and Firefox the editor just works.

After I tested, I found that if I set User-Agent to User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0,the Content-Security-Policy will not contain the script-src 'nonce-xxxxx. When I set the UA to User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36, the CSP header will contian the script-src 'nonce-xxxxx', so just change the user agent can fix it..

But why?

@plusls
Copy link

plusls commented Mar 17, 2024

Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0

fix:

nextcloud/lib/private/Security/CSP/ContentSecurityPolicyNonceManager.php

        /**
         * Check if the browser supports CSP v3
         */
        public function browserSupportsCspV3(): bool {
                $browserWhitelist = [
                        Request::USER_AGENT_CHROME,
                        Request::USER_AGENT_FIREFOX,
                        Request::USER_AGENT_SAFARI,
                        + Request::USER_AGENT_MS_EDGE,
                ];

                if ($this->request->isUserAgent($browserWhitelist)) {
                        return true;
                }

                return false;
        }

./nextcloud/custom_apps/officeonline/lib/AppInfo/Application.php

                if ($publicWopiUrl !== '') {
                        $policy->addAllowedFrameDomain('\'self\'');
                        $policy->addAllowedFrameDomain($this->domainOnly($publicWopiUrl));
                        if (method_exists($policy, 'addAllowedFormActionDomain')) {
                                $policy->addAllowedFormActionDomain($this->domainOnly($publicWopiUrl));
                        }
                        + $policy->addAllowedWorkerSrcDomain($this->domainOnly($publicWopiUrl));
                }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants