TYPO3-Solr / ext-solr

A TYPO3 extension that integrates the Apache Solr search server with TYPO3 CMS. dkd Internet Service GmbH is developing the extension. Community contributions are welcome. See CONTRIBUTING.md for details.
GNU General Public License v3.0
136 stars 248 forks source link

[BUG] Site exception in indexing task since update TYPO3 11.5.38 to 11.5.40 #4191

Open klodeckl opened 3 weeks ago

klodeckl commented 3 weeks ago

I updated TYPO3 from 11.5.38 to 11.5.40. Now I get the following error when executing the indexing scheduler task:

Uncaught TYPO3 Exception ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask::getInitializedIndexService(): Argument #1 ($site) must be of type ApacheSolrForTypo3\Solr\Domain\Site\Site, null given, called in /var/www/vendor/apache-solr-for-typo3/solr/Classes/Task/IndexQueueWorkerTask.php on line 75 thrown in file /var/www/vendor/apache-solr-for-typo3/solr/Classes/Task/IndexQueueWorkerTask.php in line 207

Manually starting the task in the backend scheduler module works fine.

solr 11.5.6 PHP 8.2

klodeckl commented 3 weeks ago

Downgrading to TYPO3 11.5.38 didn’t solve the problem. I don’t know why.

klodeckl commented 3 weeks ago

I already recreated the task but withoult luck, issue still exists

dkd-kaehm commented 2 weeks ago

@klodeckl , @seirerman I can not reproduce the issue within solr-ddev-site on TYPO3 11.5.40 The scheduler task runs as expected via CLI.

Please provide more infos about your setup:

klodeckl commented 2 weeks ago

It is a multisite system, yes.

Running the scheduler task only throws the same error message: /var/www/vendor/bin/typo3 scheduler:run --task=19 -fvv Uncaught TYPO3 Exception ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask::getInitializedIndexService(): Argument #1 ($site) must be of type ApacheSolrForTypo3\Solr\Domain\Site\Site, null given, called in /var/www/vendor/apache-solr-for-typo3/solr/Classes/Task/IndexQueueWorkerTask.php on line 75 thrown in file /var/www/vendor/apache-solr-for-typo3/solr/Classes/Task/IndexQueueWorkerTask.php in line 207

Upgrade wizards are executed und database schema is up to date.

dkd-kaehm commented 2 weeks ago

On our TYPO3 11.5.39 projects we do no have any trouble. Currently 11.5.40 is blocked for out projects by https://forge.typo3.org/issues/105239, so we can not try 11.5.40 on any of our projects.

dkd-friedrich commented 2 weeks ago

I didn't encounter any problems starting the Scheduler task in our solr-ddev-site environment with TYPO3 11.5.40.

But I was able to provoke this error, it occurs if

Perhaps there is an issue with the TypoScript or the site configuration.

seirerman commented 2 weeks ago

Site configuration is set as usual, and solr TS is included. The frontend wouldn't work without it.

Any specific values I should check?

dschlobohm commented 2 weeks ago

I had the same error, but the message was misleading. In my case, the following condition in the Typoscript was the problem:

request && request.getNormalisedParams().getHttpHost()

I had to extend it:

request && request.getNormalizedParams() && request.getNormalizedParams().getHttpHost()

You can also start the Debugger and set a breakpoint in vendor/typo3/cms-scheduler/Classes/Scheduler.php:181. Here you can read the full exception message.

All infos based on TYPO3 12.4.21.

dkd-friedrich commented 2 weeks ago

@seirerman No specific setting unfortunately I only did very basic tests and removed the TS includes completely.

IMHO the hint from @dschlobohm regarding the misleading error message is a good point, a detailed look at the exception could help to identify the error.

seirerman commented 2 weeks ago

I don't have a condition containing "request.getNormalisedParams" anywhere in my code. I also removed all of my custom solr TS, but that didn't help, either.

This is from my log:

Tue, 15 Oct 2024 09:40:04 +0200 [CRITICAL] request="facccf3df39e5" component="TYPO3.CMS.Core.Error.DebugExceptionHandler": Core: Exception handler (CLI: BE): TypeError, code 
#0, file /var/html/web/typo3conf/ext/solr/Classes/Task/IndexQueueWorkerTask.php, line 207: ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask::getInitializedIndexService(): Argument #1 ($site) must be of type ApacheSolrForTypo3\Solr\Domain\Site\Site, null given, called in /var/html/web/typo3conf/ext/solr/Classes/Task/IndexQueueWorkerTask.php on line 75- TypeError: ApacheSolrForTypo3\Solr\Task\IndexQueueWorkerTask::getInitializedIndexService(): Argument #1 ($site) must be of type ApacheSolrForTypo3\Solr\Domain\Site\Site, null given, called in /var/html/web/typo3conf/ext/solr/Classes/Task/IndexQueueWorkerTask.php on line 75, in file /var/html/web/typo3conf/ext/solr/Classes/Task/IndexQueueWorkerTask.php:207 - {"mode":"CLI","application_mode":"BE","exception_class":"TypeError","exception_code":0,"file":"/var/html/web/typo3conf/ext/solr/Classes/Task/IndexQueueWorkerTask.php","line":207,"message":"ApacheSolrForTypo3\\Solr\\Task\\IndexQueueWorkerTask::getInitializedIndexService(): Argument #1 ($site) must be of type ApacheSolrForTypo3\\Solr\\Domain\\Site\\Site, null given, called in /var/html/web/typo3conf/ext/solr/Classes/Task/IndexQueueWorkerTask.php on line 75","request_url":"http:///index.php","exception":"TypeError: ApacheSolrForTypo3\\Solr\\Task\\IndexQueueWorkerTask::getInitializedIndexService(): Argument #1 ($site) must be of type ApacheSolrForTypo3\\Solr\\Domain\\Site\\Site, null given, called in /var/html/web/typo3conf/ext/solr/Classes/Task/IndexQueueWorkerTask.php on line 75 and defined in /var/html/web/typo3conf/ext/solr/Classes/Task/IndexQueueWorkerTask.php:207\nStack trace:\n
#0 /var/html/web/typo3conf/ext/solr/Classes/Task/IndexQueueWorkerTask.php(75): ApacheSolrForTypo3\\Solr\\Task\\IndexQueueWorkerTask->getInitializedIndexService()\n
#1 /var/html/web/typo3/sysext/scheduler/Classes/Scheduler.php(192): ApacheSolrForTypo3\\Solr\\Task\\IndexQueueWorkerTask->execute()\n
#2 /var/html/web/typo3/sysext/scheduler/Classes/Command/SchedulerCommand.php(255): TYPO3\\CMS\\Scheduler\\Scheduler->executeTask()\n
#3 /var/html/web/typo3/sysext/scheduler/Classes/Command/SchedulerCommand.php(194): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->executeOrStopTask()\n
#4 /var/html/web/typo3/sysext/scheduler/Classes/Command/SchedulerCommand.php(120): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->loopTasks()\n
#5 /var/html/vendor/symfony/console/Command/Command.php(298): TYPO3\\CMS\\Scheduler\\Command\\SchedulerCommand->execute()\n
#6 /var/html/vendor/symfony/console/Application.php(1058): Symfony\\Component\\Console\\Command\\Command->run()\n
#7 /var/html/vendor/symfony/console/Application.php(301): Symfony\\Component\\Console\\Application->doRunCommand()\n
#8 /var/html/vendor/symfony/console/Application.php(171): Symfony\\Component\\Console\\Application->doRun()\n
#9 /var/html/web/typo3/sysext/core/Classes/Console/CommandApplication.php(114): Symfony\\Component\\Console\\Application->run()\n
#10 /var/html/vendor/typo3/cms-cli/typo3(23): TYPO3\\CMS\\Core\\Console\\CommandApplication->run()\n
#11 /var/html/vendor/typo3/cms-cli/typo3(24): {closure}()\n
#12 /var/html/vendor/bin/typo3(120): include('...')\n
#13 {main}"}
seirerman commented 2 weeks ago

We're testing the upgrade to TYPO3 12 at the moment (with the plan to update all of our websites by the end of the month), and fortunately ext:solr 12.0.5 is not affected. Indexing works fine with TYPO3 12.

klodeckl commented 1 week ago

I’m currently working on the update to TYPO3 12. I will test if the issue is also solved for me after the update and report it here.

Figilano commented 6 days ago

I had the same error, but the message was misleading. In my case, the following condition in the Typoscript was the problem:

request && request.getNormalisedParams().getHttpHost()

I had to extend it:

request && request.getNormalisedParams() && request.getNormalisedParams().getHttpHost()

All infos based on TYPO3 12.4.21.

I can confirm this. After an update from TYPO3 11 -> 12 (+ solr 11 -> 12), I saw the error message that the OP posted (Argument must be Site, null given). In the scheduler, when adding or editing an IndexQueueWorker-task, the site select dropdown was empty.

Changing ALL occurences of request && request.getNormalizedParams().getHttpHost()

in our own sitepackage typoscript to request && request.getNormalizedParams() && request.getNormalizedParams().getHttpHost()

the error message vanished, and the site selector drop down contained all configured sites.

Attention: dschlobohms original post/code has a typo (getNormalisedParams, with an "s"). It must be getNormalizedParams (with a "z").

dschlobohm commented 6 days ago

I've updated my post, thanks for the hint!