0

When I try and run any drush commands within ddev (even just drush itself), I get a BadRequestHttpException. My drush version is 11.0.9 . I have tried ddev restart, ddev stop/start, and ddev delete; all have the same outcome. I ran ddev composer install too and no difference. It was working at some time, but maybe a week or so ago it just stopped. Here is the verbose response from ddev drush -vvv (sorry for the large output wall):

ddev drush -vvv
 [preflight] Config paths: /var/www/html/vendor/drush/drush/drush.yml
 [preflight] Alias paths: /var/www/html/web/drush/sites,/var/www/html/drush/sites
 [preflight] Commandfile search paths: /var/www/html/vendor/drush/drush/src,/var/www/html/drush
 [info] Starting bootstrap to max [0.8 sec, 3.2 MB]
 [debug] Trying to bootstrap as far as we can [0.8 sec, 3.2 MB]
 [info] Drush bootstrap phase: bootstrapDrupalRoot() [0.8 sec, 3.2 MB]
 [info] Change working directory to /var/www/html/web [0.8 sec, 3.2 MB]
 [info] Initialized Drupal 9.3.14 root directory at /var/www/html/web [0.81 sec, 3.27 MB]
 [info] Drush bootstrap phase: bootstrapDrupalSite() [0.82 sec, 3.28 MB]

In DrupalKernel.php line 372:
                                                                    
  [Symfony\Component\HttpKernel\Exception\BadRequestHttpException]  
                                                                    

Exception trace:
  at /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php:372
 Drupal\Core\DrupalKernel::findSitePath() at /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php:109
 Drush\Boot\DrupalBoot8->confPath() at /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php:158
 Drush\Boot\DrupalBoot8->bootstrapDoDrupalSite() at /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot.php:158
 Drush\Boot\DrupalBoot->bootstrapDrupalSite() at /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php:291
 Drush\Boot\BootstrapManager->doBootstrap() at /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php:477
 Drush\Boot\BootstrapManager->bootstrapMax() at /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php:412
 Drush\Boot\BootstrapManager->bootstrapToPhaseIndex() at /var/www/html/vendor/drush/drush/src/Boot/BootstrapManager.php:384
 Drush\Boot\BootstrapManager->bootstrapToPhase() at /var/www/html/vendor/drush/drush/src/Boot/BootstrapHook.php:32
 Drush\Boot\BootstrapHook->initialize() at /var/www/html/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:44
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->doInitializeHook() at /var/www/html/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:36
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->callInitializeHook() at /var/www/html/vendor/consolidation/annotated-command/src/Hooks/Dispatchers/InitializeHookDispatcher.php:29
 Consolidation\AnnotatedCommand\Hooks\Dispatchers\InitializeHookDispatcher->initialize() at /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php:145
 Consolidation\AnnotatedCommand\CommandProcessor->initializeHook() at /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php:335
 Consolidation\AnnotatedCommand\AnnotatedCommand->initialize() at /var/www/html/vendor/symfony/console/Command/Command.php:221
 Symfony\Component\Console\Command\Command->run() at /var/www/html/vendor/symfony/console/Application.php:1027
 Symfony\Component\Console\Application->doRunCommand() at /var/www/html/vendor/symfony/console/Application.php:273
 Symfony\Component\Console\Application->doRun() at /var/www/html/vendor/symfony/console/Application.php:149
 Symfony\Component\Console\Application->run() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:124
 Drush\Runtime\Runtime->doRun() at /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php:51
 Drush\Runtime\Runtime->run() at /var/www/html/vendor/drush/drush/drush.php:72
 require() at /var/www/html/vendor/drush/drush/drush:3
 include() at /var/www/html/vendor/bin/drush:112

Failed to run drush -vvv: exit status 1

Any guidance would be helpful.

PartyHatPanda
  • 712
  • 8
  • 14
  • 1
    I would guess this is a problem with your project, not with ddev. And there is no such thing as `ddev rebuild`. If you can give information about your Drupal version, and `ddev drush --version` that will be helpful. But I think the best thing to do would be to do a simple D9 quickstart and try this there... I think you'll find it works fine. https://ddev.readthedocs.io/en/latest/users/cli-usage/#drupal-9-quickstart – rfay May 31 '22 at 21:12
  • What happened a week ago? Go through commit history. Folder structure changed? Does the same happen when you check out and start the project on a different machine? When was the last time you've run `ddev composer install`? – leymannx May 31 '22 at 22:22
  • Sorry, I wasn't trying to imply that there is an issue with ddev - just I'm not sure where to look in my project. AFAIK nothing has changed since this stopped working. I just did a `ddev composer install` to check and while that worked, drush still isn't. And I meant `ddev restart`, sorry coming from lando. drush is version 11.0.9 . I'll update the ticket with the new information. – PartyHatPanda Jun 02 '22 at 12:53

1 Answers1

0

So what the issue turned out to be was the port in the settings.ddev.php didn't match the port that was registered to the database - it didn't match what was returned with ddev describe. I deleted the settings.ddev.php file and ran a new ddev pull with my provider to regenerate the settings file and that resynced the ports and resolved the issue.

PartyHatPanda
  • 712
  • 8
  • 14