Drush 12 compatibility

Created on 22 June 2023, over 1 year ago
Updated 18 September 2024, about 2 months ago

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

💬 Support request
Status

Fixed

Version

2.0

Component

Code

Created by

🇺🇸United States mortona2k Seattle

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mortona2k
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MariaDB 10.3.22
    last update over 1 year ago
    4 pass
  • @mortona2k opened merge request.
  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MariaDB 10.3.22
    last update over 1 year ago
    4 pass
  • Status changed to Needs work over 1 year ago
  • e0ipso Can Picafort

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

  • First commit to issue fork.
  • Open in Jenkins → Open on Drupal.org →
    Core: 10.0.7 + Environment: PHP 8.1 & MariaDB 10.3.22
    last update about 1 year ago
    4 pass
  • Status changed to Needs review about 1 year ago
  • 🇺🇸United States wells Seattle, WA
  • 🇺🇸United States selwynpolit

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

  • Status changed to RTBC about 1 year ago
  • e0ipso Can Picafort

    I tested this with Drush 12 and Drush 11.

  • Pipeline finished with Skipped
    about 1 year ago
    #44800
  • Status changed to Fixed about 1 year ago
  • Status changed to Needs review about 1 year ago
  • 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

  • 🇺🇸United States wells Seattle, WA

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

  • 🇨🇦Canada joseph.olstad

    This is still RTBC, if this is important to you, please click the maintainers profiles and send a message via their contact tab, their usernames are found on the project page.
    Please ask them politely to prioritize a release including this fix.

    If you suspect like I do that this project has potentially been abandoned, I encourage you to embark on the path to maintainership.

    Here are the steps to take to become a maintainer of potentially abandonned projects:
    https://www.drupal.org/docs/develop/managing-a-drupalorg-theme-module-or...

  • Merge request !15Resolve #3368778 "Drush 12 compatibility" → (Merged) created by joseph.olstad
  • Pipeline finished with Canceled
    9 months ago
    Total: 105s
    #95393
  • Pipeline finished with Failed
    9 months ago
    Total: 206s
    #95398
  • e0ipso Can Picafort

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

  • Pipeline finished with Skipped
    9 months ago
    #98331
  • Status changed to Fixed 9 months ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

  • 🇳🇬Nigeria oscarclement

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

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

  • 🇦🇺Australia amjad1233 Brisbane

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

  • 🇧🇪Belgium flyke

    Same issue here on Drupal 10.3.5 with Drush 13.2.0 and warmer 2.0.11

  • 🇧🇪Belgium flyke

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

  • 🇦🇹Austria maxilein

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

    Only solution was to uninstall

Production build 0.71.5 2024