Problem/Motivation

Drush 12 removes the queue.commands service, which is used in warmer/drush.services.yml. Because of this, drush breaks when a site has warmer installed because it can't find the service class.

Steps to reproduce

Install drush 12 on a site with warmer. Run a drush command like cr.

Error:

In LegacyServiceInstantiator.php line 282:                                                        
  You have requested a non-existent parameter "queue.commands".

Proposed resolution

Replace drush service with use of $this->processManager()->drush().

Remaining tasks

Review patch

CommentFileSizeAuthor
#12 drush-12-compatibility-3368778-12.patch965 bytesafi13

Issue fork warmer-3368778

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mortona2k created an issue. See original summary.

e0ipso made their first commit to this issue’s fork.

e0ipso’s picture

Status: Active » Needs work

I tried to modernize the dependency injection and failed. Sorry for messing with your MR @mortona2k.

wells made their first commit to this issue’s fork.

wells’s picture

Status: Needs work » Needs review
selwynpolit’s picture

I downgraded drush to version 11 for now and permitted me to run the drush commands I needed for my d9-d10 upgrade.

composer require 'drush/drush:~11' -W

e0ipso’s picture

Status: Needs review » Reviewed & tested by the community

I tested this with Drush 12 and Drush 11.

  • e0ipso committed aeb73422 on 2.x authored by mortona2k
    Issue #3368778 by e0ipso, mortona2k, wells, selwynpolit, moshe weitzman...
e0ipso’s picture

Status: Reviewed & tested by the community » Fixed
//www.flaticon.com/free-icons/thank-you Thank you for your contribution! Your continued support to this project makes my volunteer contributions more sustainable.
There are multiple ways to show appreciation for the work I did in this project, those include:
  • Triaging issues, and adding more context to existing issues.
  • Writing documentation, or patches for this project.
  • Writing blog posts, speaking about it at conferences.
afi13’s picture

Status: Fixed » Needs review
StatusFileSize
new965 bytes

It looks like the drush command doesn't implement the SiteAliasManagerAwareInterface, so I got the following error

Error: Call to a member function getSelf() on null in /var/www/web/modules/contrib/warmer/src/Drush/Commands/WarmerCommands.php on line 118 #0 [internal function]: Drupal\warmer\Drush\Commands\WarmerCommands->enqueue(Array, Array)
#1 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#2 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#3 /var/www/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#4 /var/www/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#5 /var/www/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /var/www/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /var/www/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /var/www/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
#12 /var/www/vendor/drush/drush/drush(4): require('/var/www/vendor...')
#13 /var/www/vendor/bin/drush(119): include('/var/www/vendor...')
#14 {main}
Error: Call to a member function getSelf() on null in Drupal\warmer\Drush\Commands\WarmerCommands->enqueue() (line 118 of /var/www/web/modules/contrib/warmer/src/Drush/Commands/WarmerCommands.php).

It's related to this line

$this->processManager()->drush($this->siteAliasManager()->getSelf(), 'queue:run', ['warmer'], ['time-limit' => static::VERY_HIGH_NUMBER, 'items-limit' => $total]);

$this->siteAliasManager() is empty because dependency is not passed

Fixed in the patch

wells’s picture

In Drush 11 I'm also getting a similar exception. Patch in #12 fixes the issue.

Error: Call to a member function getSelf() on null in /app/docroot/modules/contrib/warmer/src/Drush/Commands/WarmerCommands.php on line 118 #0 [internal function]: Drupal\warmer\Drush\Commands\WarmerCommands->enqueue(Array, Array)
#1 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#2 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#3 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#4 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#5 /app/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 /app/vendor/symfony/console/Application.php(1081): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /app/vendor/symfony/console/Application.php(320): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /app/vendor/symfony/console/Application.php(174): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /app/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /app/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /app/vendor/drush/drush/drush.php(79): Drush\Runtime\Runtime->run(Array)
#12 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
#13 /app/vendor/bin/drush(119): include('/app/vendor/dru...')
#14 {main}
Error: Call to a member function getSelf() on null in Drupal\warmer\Drush\Commands\WarmerCommands->enqueue() (line 118 of /app/docroot/modules/contrib/warmer/src/Drush/Commands/WarmerCommands.php).
 [warning] Drush command terminated abnormally.
jonblatho’s picture

Can we please get a fresh release with this patch merged? Drupal 10.2.x requires Drush 12 or later, and this issue is the only thing blocking us from upgrading.

joseph.olstad’s picture

I have contacted the maintainers and have politely asked for action.

e0ipso’s picture

Status: Needs review » Fixed

I don't have any D10 site running with Warmer. This looks like it should fix the issue. I will give this a go.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

oscarclement’s picture

@e0ipso This issue exists even in the latest version of warmer (2.0.13). @jonblatho were you able to find a way around the issue?

jonblatho’s picture

@oscarclement: Sorry for the delayed response. We pushed production updates this week with Warmer 2.0.13, Drush 12.5, and Drupal 10.2.x without any apparent issues. Is the error output identical to that mentioned in the original issue?

amjad1233’s picture

I am getting same issue on Drupal 13. Turning off warmer for now.

flyke’s picture

Same error here on Drupal 10.3.5 with Drush 13.2.0 and warmer 2.0.11.
Its impossible to use warmer 2.0.12 or 2.0.13 or 2.x because those versions dont work with drush^13.

In LegacyServiceInstantiator.php line 283:
You have requested a non-existent parameter "queue.commands".

The MR and patch #12 cannot not apply, but the changes are also not present in the code. For example:
WarmerCommands.php line 19 is:
class WarmerCommands extends DrushCommands {
Instead of:
class WarmerCommands extends DrushCommands implements SiteAliasManagerAwareInterface {

For now I had to remove the module for all my projects in order to have them updated to Drush 13.

flyke’s picture

Related issues: +#3467609: Drush 13

Added issue #3467609 (drush 13 compatibility) as related because I think removing the drush version altogether as dependency is the way to go.

maxilein’s picture

It also does not work for me.
D 10.3.6 php 8.3 drush 13.2

Only solution was to uninstall