nextcloud / fulltextsearch_elasticsearch

🔍 Use Elasticsearch to index the content of your Nextcloud
GNU Affero General Public License v3.0
79 stars 29 forks source link

PHP Fatal error: Declaration of Elastic\Elasticsearch\Response\Elasticsearch::withStatus #341

Open 3038922 opened 7 months ago

3038922 commented 7 months ago

ubuntu 22.04. php 8.1 elasticsearch 8.6.1

 ⚡ root@nextcloud  ~  sudo -u www-data php /var/www/nextcloud/occ  fulltextsearch:test

.Testing your current setup:
Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 items) ok
Loading search platform. (Elasticsearch) ok
Testing search platform. PHP Fatal error:  Declaration of Elastic\Elasticsearch\Response\Elasticsearch::withStatus(int $code, string $reasonPhrase = ''): Psr\Http\Message\ResponseInterface must be compatible with Psr\Http\Message\ResponseInterface::withStatus($code, $reasonPhrase = '') in /var/www/nextcloud/apps/fulltextsearch_elasticsearch/vendor/elasticsearch/elasticsearch/src/Traits/MessageResponseTrait.php on line 87
 ⚡ root@nextcloud  ~  sudo -u www-data php --ini
Configuration File (php.ini) Path: /etc/php/8.1/cli
Loaded Configuration File:         /etc/php/8.1/cli/php.ini
Scan for additional .ini files in: /etc/php/8.1/cli/conf.d
Additional .ini files parsed:      /etc/php/8.1/cli/conf.d/10-mysqlnd.ini,
/etc/php/8.1/cli/conf.d/10-opcache.ini,
/etc/php/8.1/cli/conf.d/10-pdo.ini,
/etc/php/8.1/cli/conf.d/15-xml.ini,
/etc/php/8.1/cli/conf.d/20-apcu.ini,
/etc/php/8.1/cli/conf.d/20-bcmath.ini,
/etc/php/8.1/cli/conf.d/20-bz2.ini,
/etc/php/8.1/cli/conf.d/20-calendar.ini,
/etc/php/8.1/cli/conf.d/20-ctype.ini,
/etc/php/8.1/cli/conf.d/20-curl.ini,
/etc/php/8.1/cli/conf.d/20-dom.ini,
/etc/php/8.1/cli/conf.d/20-exif.ini,
/etc/php/8.1/cli/conf.d/20-ffi.ini,
/etc/php/8.1/cli/conf.d/20-fileinfo.ini,
/etc/php/8.1/cli/conf.d/20-ftp.ini,
/etc/php/8.1/cli/conf.d/20-gd.ini,
/etc/php/8.1/cli/conf.d/20-gettext.ini,
/etc/php/8.1/cli/conf.d/20-gmp.ini,
/etc/php/8.1/cli/conf.d/20-iconv.ini,
/etc/php/8.1/cli/conf.d/20-igbinary.ini,
/etc/php/8.1/cli/conf.d/20-imagick.ini,
/etc/php/8.1/cli/conf.d/20-intl.ini,
/etc/php/8.1/cli/conf.d/20-ldap.ini,
/etc/php/8.1/cli/conf.d/20-mbstring.ini,
/etc/php/8.1/cli/conf.d/20-mysqli.ini,
/etc/php/8.1/cli/conf.d/20-pdo_mysql.ini,
/etc/php/8.1/cli/conf.d/20-phar.ini,
/etc/php/8.1/cli/conf.d/20-posix.ini,
/etc/php/8.1/cli/conf.d/20-readline.ini,
/etc/php/8.1/cli/conf.d/20-redis.ini,
/etc/php/8.1/cli/conf.d/20-shmop.ini,
/etc/php/8.1/cli/conf.d/20-simplexml.ini,
/etc/php/8.1/cli/conf.d/20-sockets.ini,
/etc/php/8.1/cli/conf.d/20-sysvmsg.ini,
/etc/php/8.1/cli/conf.d/20-sysvsem.ini,
/etc/php/8.1/cli/conf.d/20-sysvshm.ini,
/etc/php/8.1/cli/conf.d/20-tokenizer.ini,
/etc/php/8.1/cli/conf.d/20-xmlreader.ini,
/etc/php/8.1/cli/conf.d/20-xmlrpc.ini,
/etc/php/8.1/cli/conf.d/20-xmlwriter.ini,
/etc/php/8.1/cli/conf.d/20-xsl.ini,
/etc/php/8.1/cli/conf.d/20-zip.ini
timdodge commented 6 months ago

Seems to be this issue: https://github.com/elastic/elasticsearch-php/issues/1342

jstampfer commented 6 months ago

Same here, but I have no idea how to fix it with this: https://github.com/elastic/elasticsearch-php/issues/1342

Testing search platform. PHP Fatal error: Declaration of Elastic\Elasticsearch\Response\Elasticsearch::withStatus(int $code, string $reasonPhrase = ''): Psr\Http\Message\ResponseInterface must be compatible with Psr\Http\Message\ResponseInterface::withStatus($code, $reasonPhrase = '') in /var/www/nextcloud/apps/fulltextsearch_elasticsearch/vendor/elasticsearch/elasticsearch/src/Traits/MessageResponseTrait.php on line 87

I get this error:

┌─ Errors ──── │ Error: 1642/1642 │ Index: files:315863 │ Exception: Elastic\Elasticsearch\Exception\ServerResponseException │ Message: unknown error

edgeofthex commented 6 months ago

I get the same error message when I run sudo -u www-data php /var/www/nextcloud/occ fulltextsearch:test. I wonder if this indexing app is working for anybody, or is it just a few people running into problems?

aakerbeere commented 6 months ago

My instance is actually not throwing errors. I'm however not sure if it is doing the job as expected. Don't know how to test otherwise:

.Testing your current setup:  
Creating mocked content provider. ok  
Testing mocked provider: get indexable documents. (2 items) ok  
Loading search platform. (Elasticsearch) ok  
Testing search platform. ok  
Locking process ok  
Removing test. ok  
Pausing 3 seconds 1 2 3 ok  
Initializing index mapping. ok  
Indexing generated documents. ok  
Pausing 3 seconds 1 2 3 ok  
Retreiving content from a big index (license). (size: 32386) ok  
Comparing document with source. ok  
Searching basic keywords:  
 - 'test' (result: 1, expected: ["simple"]) ok  
 - 'document is a simple test' (result: 2, expected: ["simple","license"]) ok  
 - '"document is a test"' (result: 0, expected: []) ok  
 - '"document is a simple test"' (result: 1, expected: ["simple"]) ok  
 - 'document is a simple -test' (result: 1, expected: ["license"]) ok  
 - 'document is a simple +test' (result: 1, expected: ["simple"]) ok  
 - '-document is a simple test' (result: 0, expected: []) ok  
 - 'document is a simple +test +testing' (result: 1, expected: ["simple"]) ok  
 - 'document is a simple +test -testing' (result: 0, expected: []) ok  
 - 'document is a +simple -test -testing' (result: 0, expected: []) ok  
 - '+document is a simple -test -testing' (result: 1, expected: ["license"]) ok  
 - 'document is a +simple -license +testing' (result: 1, expected: ["simple"]) ok  
Updating documents access. Force Quit

Instance:

Rasperry Pi 4 Model B Rev 1.4 8GB
Debian GNU/linux 12 (bookworm)
NC "27.1.5.1"
Webserver "Apache/2.4.57 (Debian)"
PHP "8.2.14"
DB "PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit"
Full text search - Elasticsearch Platform 27.0.5
Full text search 27.0.3
Full text search - Files 27.0.1
Full text search - Files - Tesseract OCR 27.0.0
elasticsearch/stable,now 8.11.3 arm64 with readonlyrest

cheers

bt1v1 commented 6 months ago

I get the same error with nextcloud 28. All plugins have also been updated to version >28.

edgeofthex commented 6 months ago

I get the same error with nextcloud 28. All plugins have also been updated to version >28.

I'm on 28 as well.

jstampfer commented 6 months ago

If I make "sudo -u www-data php occ fulltextsearch:test" then I get the following errors:

.Testing your current setup: Creating mocked content provider. ok Testing mocked provider: get indexable documents. (2 items) ok Loading search platform. (Elasticsearch) ok Testing search platform. PHP Fatal error: Declaration of Elastic\Elasticsearch\Response\Elasticsearch::withStatus(int $code, string $reasonPhrase = ''): Psr\Http\Message\ResponseInterface must be compatible with Psr\Http\Message\ResponseInterface::withStatus($code, $reasonPhrase = '') in /var/www/nextcloud/apps/fulltextsearch_elasticsearch/vendor/elasticsearch/elasticsearch/src/Traits/MessageResponseTrait.php on line 87

Nextcloud version: 28.0.1 all updates installed

PHP-Version: 8.1.27

Elasticsearch: 8.11.3

I run the following Ubuntu: Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focal

SanMichele commented 4 months ago

Hello, I'm on NC28 and ES 8.12.1, same error. Is it an Elastic error or a Nextcloud error? Who is responsible to solve it? THX, Michael

random6150 commented 4 months ago

I installed NC28 and ES 8.12 and hit the same error.

I'm not a coder but I followed up the error message and it seems working by making some changes to /var/www/nextcloud/apps/fulltextsearch_elasticsearch/vendor/elasticsearch/elasticsearch/src/Traits/MessageResponseTrait.php in lines 42, 57, 62, 67, and 87.

I have no idea how to show changes in the reply, please see the attached file. MessageResponseTrait.zip

After applying the changes, the fulltextsearch seems working. It ignores one of my external local storage folders however, this may be another issue.

Wish you guys good luck.

SanMichele commented 4 months ago

Hi, found it: With the app Carnet also comes ./apps/carnet/vendor/psr/http-message/src/ResponseInterface.php with the wrong declaration. Delete Carnet and the error is gone. Kind regards, Michael

s90570 commented 4 months ago

Hi, found it: With the app Carnet also comes ./apps/carnet/vendor/psr/http-message/src/ResponseInterface.php with the wrong declaration. Delete Carnet and the error is gone. Kind regards, Michael

Incomprehensible. Yes. It was enough to turn off the Carnet. But what is the problem? Carnet or Elasticsearch?

random6150 commented 4 months ago

I guess the problem was caused by Carnet. I removed Carnet and reinstalled elasticsearch without any modification, everything works well.

From my previous modification, this might because Carnet incorporated and old version of psr components, which loaded first.

TomS @.***> 於 2024年2月29日 週四 17:28 寫道:

Hi, found it: With the app Carnet also comes ./apps/carnet/vendor/psr/http-message/src/ResponseInterface.php with the wrong declaration. Delete Carnet and the error is gone. Kind regards, Michael

Incomprehensible. Yes. It was enough to turn off the Carnet. But what is the problem? Carnet or Elasticsearch?

— Reply to this email directly, view it on GitHub https://github.com/nextcloud/fulltextsearch_elasticsearch/issues/341#issuecomment-1970740521, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGGFZ4Z5QDZJFRMUCCS5RKLYV32FLAVCNFSM6AAAAABAQ3KVD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQG42DANJSGE . You are receiving this because you commented.Message ID: @.***>

s90570 commented 4 months ago

I guess the problem was caused by Carnet. I removed Carnet and reinstalled elasticsearch without any modification, everything works well. From my previous modification, this might because Carnet incorporated and old version of psr components, which loaded first.

Exactly! I renamed /nextcloud/apps/carnet/vendor/psr/http-message to /nextcloud/apps/carnet/vendor/psr/http-messageOLD and made a symlink to /nextcloud/apps/fulltextsearch_elasticsearch/vendor/psr/http-message. Carnet still uses psr/http-message version 1.x while elasticsearch uses version 2.0 already.

And it seems to be working. Many thanks gentlemen!!!