johannschopplich / kirby-algolia-docsearch

🔦 Index and search your Kirby site with Algolia DocSearch
https://kirby.tools
MIT License
25 stars 0 forks source link

Fatal error on reindex command #3

Closed olivertedwards closed 1 year ago

olivertedwards commented 1 year ago

Have been having a great time with this plugin before the summer holidays, and came back to an issue when running kirby algolia-docsearch:index to reindex the site I am working on.

Running the command gives me a fatal error related to PSR. I have tested different version of Kirby 3.9, and also 4.0 alpha 4 (which was previously working as well).

Here is the terminal output when executing the CLI index command with plugin v0.4.0.

Fatal error: Declaration of Algolia\AlgoliaSearch\Http\Psr7\Uri::getScheme() must be compatible with Psr\Http\Message\UriInterface::getScheme(): string in /Users/drx/Sites/ts/vendor/algolia/algoliasearch-client-php/src/Http/Psr7/Uri.php on line 390
Whoops\Exception\ErrorException: Declaration of Algolia\AlgoliaSearch\Http\Psr7\Uri::getScheme() must be compatible with Psr\Http\Message\UriInterface::getScheme(): string in file /Users/drx/Sites/ts/vendor/algolia/algoliasearch-client-php/src/Http/Psr7/Uri.php on line 390
Stack trace:
  1. Whoops\Exception\ErrorException->() /Users/drx/Sites/ts/vendor/algolia/algoliasearch-client-php/src/Http/Psr7/Uri.php:390
  2. Whoops\Run->handleError() /Users/drx/Sites/ts/vendor/filp/whoops/src/Whoops/Run.php:514
  3. Whoops\Run->handleShutdown() [internal]:0

An here is the config file:

<?php

return [
    'languages' => true,
    'johannschopplich.algolia-docsearch'  => [
        'appId' => 'XXX',
        'apiKey' => 'XXX',
        'index' => 'dev_site',
        'content' => 'main',
        'templates' => [
        'article',
        'listing'
        ],
        'label' => [
        'default' => [
          'da' => 'Side',
          'en' => 'Page'
        ],
        'templates' => [
          'article' => [
            'da' => 'Artikler',
            'en' => 'Articles'
          ],
          'listing' => [
            'da' => 'Listing',
            'en' => 'Listing'
          ]
        ]
        ],
    ],

];

The fatal error occurs both when executing directly with the CLI and through the janitor plugin as described in the readme.

Not sure what is going Johann, any ideas?

Best Oliver

johannschopplich commented 1 year ago

Hi there, thanks for the thorough report! This is an upstream error and will be fixed by the PR https://github.com/algolia/algoliasearch-client-php/pull/717. Unfortunately, it seems to be open for a while…

olivertedwards commented 1 year ago

Thank you @johannschopplich, at least that is good to know!

johannschopplich commented 1 year ago

@tobimori Should be resolved by https://github.com/algolia/algoliasearch-client-php/pull/717. I have upgraded the Kirby plugin to use the latest Algolia package.

olivertedwards commented 1 year ago

Beautiful, @johannschopplich, have a great Monday afternoon :)