ext-solr icon indicating copy to clipboard operation
ext-solr copied to clipboard

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

Open klodeckl opened this issue 1 year ago • 11 comments

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 avatar Oct 11 '24 06:10 klodeckl

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

klodeckl avatar Oct 11 '24 07:10 klodeckl

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

klodeckl avatar Oct 11 '24 08:10 klodeckl

@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:

  • Multiple sites/roots?
  • some other extensions with scheduler tasks(try to disable all, except ext-solrs. Alternativelly run the ext-solr task only: typo3 scheduler:run --task=<ID_of_EXT:solr-task> -f)?
  • All upgrade wizard are executed
  • Database schema is up to date?

dkd-kaehm avatar Oct 14 '24 07:10 dkd-kaehm

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.

klodeckl avatar Oct 14 '24 08:10 klodeckl

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-kaehm avatar Oct 14 '24 11:10 dkd-kaehm

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

  • EXT:solr TypoScript configuration was not included
  • no site was configured

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

dkd-friedrich avatar Oct 14 '24 12:10 dkd-friedrich

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

Any specific values I should check?

seirerman avatar Oct 15 '24 06:10 seirerman

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.

dschlobohm avatar Oct 15 '24 07:10 dschlobohm

@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.

dkd-friedrich avatar Oct 15 '24 07:10 dkd-friedrich

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 avatar Oct 15 '24 07:10 seirerman

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.

seirerman avatar Oct 18 '24 06:10 seirerman

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.

klodeckl avatar Oct 21 '24 19:10 klodeckl

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").

Figilano avatar Oct 26 '24 12:10 Figilano

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

dschlobohm avatar Oct 26 '24 12:10 dschlobohm

Updatet to TYPO3 12 solved this problem for me too.

klodeckl avatar Nov 14 '24 16:11 klodeckl

We had a similar issue in combination with werkraummedia/abtest. Check out our solution here: https://github.com/werkraum-media/abtest/pull/3 https://github.com/werkraum-media/abtest/issues/4

tl;dr: It was a Hook that modified the TypoScriptFrontendController. We disabled it in CLI context.

localhorst avatar Nov 29 '24 12:11 localhorst

Wow, I wasted a day until I found this issue. In case it helps someone, in my case it was a TypoScriptConditionProvider registered via Configuration/ExpressionLanguage.php instead via Services.yaml after upgrading from 11.5 to 12.4. I wrote some custom indexers and these just could not get any solr site configuration anymore...

sascha-schieferdecker avatar Dec 20 '24 17:12 sascha-schieferdecker