Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
klodeckl opened this issue Oct 11, 2024 · 17 comments
Closed

Comments

@klodeckl
Copy link

klodeckl commented Oct 11, 2024

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
Copy link
Author

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

@klodeckl
Copy link
Author

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

@dkd-kaehm
Copy link
Collaborator

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

@klodeckl
Copy link
Author

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
Copy link
Collaborator

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
Copy link
Member

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.

@seirerman
Copy link
Contributor

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
Copy link

dschlobohm commented Oct 15, 2024

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
Copy link
Member

@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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Author

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
Copy link
Contributor

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
Copy link

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

@klodeckl
Copy link
Author

Updatet to TYPO3 12 solved this problem for me too.

@localhorst
Copy link

We had a similar issue in combination with werkraummedia/abtest.
Check out our solution here:
werkraum-media/abtest#3
werkraum-media/abtest#4

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

@sascha-schieferdecker
Copy link
Contributor

sascha-schieferdecker commented Dec 20, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants