Server: Problem with GuzzleHttp

Created on 19 Sep 2018  路  12Comments  路  Source: nextcloud/server

Can not open file with Collabora Office (local docker installation)
Collabora online application version is 2.0.13 (richdocuments)

Expected behaviour

Office format file is opened within Nextcloud window

Actual behaviour

In case WOPI server field is blank in the settings of the Collabora online (fresh install of this app) we have
Fatal error: Cannot declare class GuzzleHttp\Handler\CurlFactory, because the name is already in use in /var/www/.../3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 16

In case WOPI server field is filled in:
Fatal error: Cannot declare class GuzzleHttp\Exception\RequestException, because the name is already in use in /var/www/.../3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php on line 0

I suspect that there is no proper connection between nextcloud and Collabora Office in docker container and this causes the last Error.

Operating system:
Linux Debian Jessie

Web server:
Nginx+PHP-FPM

Database:
MySQL

PHP version:
7.1.20

Nextcloud version:
14.0

Updated from an older Nextcloud/ownCloud or fresh install:
Updated from 13.6

bug

All 12 comments

GitMate.io thinks possibly related issues are https://github.com/nextcloud/server/issues/9152 (Problem renaming folders), https://github.com/nextcloud/server/issues/9356 (problem with updater ), https://github.com/nextcloud/server/issues/4908 (Problem upgrading NextCloud), https://github.com/nextcloud/server/pull/11133 (Fix exception class), and https://github.com/nextcloud/server/issues/11197 (Problems with "digital" usernames).

I found the origin of the problem.
You need to specifiy IP-address of collabora online server explicitly in nginx ssl section like this:

listen xxx.xxx.xxx.xxx 443 ssl;

In most internet instructions with nginx reverse proxy settings including collabora this listen directive is specified as

listen 443 ssl;

The second error (Cannot declare class GuzzleHttp\Exception\RequestException) appears due to invalid sertificate if IP is not specified.
Our webserver and nextcloud installation run in LXC Proxmox container with ISPmanager panel. Hope this info helps those who works in the same environment.

Nonetheless I think that the above errors should be properly processed to help nextcloud administrators in Collabora online installation rather then go in blind.

Having the same issue all day long I finally found out that my self-signed certificate was the problem. While my Browser knows the full chain of a letsencrypt certificate the internal curl function of nextcloud does not. Copying the fullchain certificate to my nginx-container solved the Problem.

Having this issue with Nextcloud 14.0.3 updated from 13, Collabora Online (richdocuments) 3.0.1, Ubuntu 16.04, PHP 7.0, Apache. Collabora itself was installed via repo and was working fine before Nextcloud upgrade.

Using Letsencrypt certs, declaring ip (not *) in Listen directive and VirtualHost conf.
Error:
PHP Fatal error: Cannot declare class GuzzleHttp\\Exception\\RequestException, because the name is already in use in /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Exception/RequestException.php on line 0

If I set the Collabora url in admin settings to https://127.0.0.1:9980 instead of https://example.com the error becomes:

Cannot declare class GuzzleHttp\\Handler\\CurlFactory, because the name is already in use in /var/www/nextcloud/3rdparty/guzzlehttp/guzzle/src/Handler/CurlFactory.php on line 16


UPDATE

Solved! it was an expired certificate for the loolwsd server. Going to update the settings in loolwsd server instead of the hack I did when I set it up ;) Hope this helps someone in a similar spot.

Thank you for reporting back :+1:

I had the same issue - in my case it was because my NC was not a native subdomain. "https://server.foo.bar/nc"
I changed NC to run on this URL "https://nc.foo.bar" and start a new collabbora docker with this new domain and it works perfectly now!

this came back after updating to collabora 6.0.0 from repo while using collabora NC app v 3.1.0 in NC 14.0.4
All certificates / settings are appropriate and up to date

@joshp23 - I have exactly the same problem since updating from the repo, I had a perfectly working NC14 install until then. Did you manage to resolve yours?

this came back after updating to collabora 6.0.0 from repo while using collabora NC app v 3.1.0 in NC 14.0.4
All certificates / settings are appropriate and up to date

@jodoe I snooped about here paying attention to step 4, and here paying attention to option 2.

Therefore, to get it working I updated the config script at /etc/loolwsd/loolwsd.xml to contain new options in 6.0 update, then set net.listen=loopback for security reasons as I then set ssl.enable=false, and ssl.termination=true. I made sure that the reverse proxy in Nginx is calling plain all addresses such as http://localhost:9980; and so forth. Restarted loolwsd and it worked for me!

@joshp23 thanks for the reply, it ended up being the lo_template_path, it wasn't pointing at collaboraoffice6.0, as it was still using the old config file, it was pointing at collaboraoffice5.3. I changed this and everything's working again :)

@jodoe right on. Glad you mentioned that point. That was the first option that I u reset as well, only it did not result in a functional environment, which happened only after I completed the above steps.

Glad that you got things working.

In my case the problem was a misconfiguration of the Collabora virtualhost. The error Cannot declare class GuzzleHttp\Handler\CurlFactory was pretty obscure but I've found better clues on the nextcloud.log file.

(hth)

Was this page helpful?
0 / 5 - 0 ratings