Problem/Motivation
Config cannot be exported through drush.
TypeError: Drush\Drupal\Commands\config\ConfigExportCommands::getConfigStorageSync(): Return value must be of type Drupal\Core\Config\StorageInterface, null returned in Drush\Drupal\Commands\config\ConfigExportCommands->getConfigStorageSync() (line 68 of /var/www/html/vendor/drush/drush/src/Drupal/Commands/config/ConfigExportCommands.php) #0 /var/www/html/vendor/drush/drush/src/Drupal/Commands/config/ConfigExportCommands.php(122): Drush\Drupal\Commands\config\ConfigExportCommands->getConfigStorageSync()
#1 /var/www/html/vendor/drush/drush/src/Drupal/Commands/config/ConfigExportCommands.php(110): Drush\Drupal\Commands\config\ConfigExportCommands->doExport(NULL, '../config/sync')
#2 /var/www/html/html/profiles/wxt/modules/custom/wxt_ext/wxt_ext_config/src/Commands/Wxtcex.php(36): Drush\Drupal\Commands\config\ConfigExportCommands->export(NULL, Array)
#3 [internal function]: Drupal\wxt_ext_config\Commands\Wxtcex->wxtConfigExport(Array)
#4 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#5 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#6 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#7 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(350): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#8 /var/www/html/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /var/www/html/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /var/www/html/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /var/www/html/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /var/www/html/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))
#13 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /var/www/html/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#15 /var/www/html/vendor/drush/drush/drush(4): require('/var/www/html/v...')
#16 /var/www/html/vendor/bin/drush(120): include('/var/www/html/v...')
#17 {main}.
Steps to reproduce
Run drush wxt_ext_config:wxt-cex
or drush cex
. The Type Error will be displayed.
Proposed resolution
I have tried two things, one of them was to create the patch mentioned in this Github issue here: https://github.com/drush-ops/drush/issues/5260. The patch does stop the type error but it does not fix the problem as the config export does not pick up on the active configuration that needs to be exported.
I then went and uninstalled the wxt_ext_config
module, and while I was not able to export config via drush wxt_ext_config:wxt-cex
, I was able to export config using drush cex
as normal, like it was prior to drush 11.2
version upgrade. Without the wxt_ext_config
module installed, the drush config export functions normally.
Through some debugging, it seems like when this module is installed, the configStorageSync inside the ConfigExportCommands.php drush module is trying to be accessed through its get function before it has been set.
Any guidance would be appreciated. Thank you
Issue fork wxt-3315821
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
Comment #2
smulvih2Comment #3
DieterHolvoet CreditAttribution: DieterHolvoet at Minsky commentedThis issue was fixed upstream. It should be fixed after running the following command and rebuilding your caches:
Comment #4
mazz0016 CreditAttribution: mazz0016 commentedThank you! The command above in #3 solves my issue.
Comment #5
smulvih2This works for me too. I ran
composer update drush/drush -W
(to update with dependencies) and it updatedconsolidation/annotated-command
from 4.5.6 to 4.5.7 and resolved the issue. Thanks for your help with this guys and for posting back to the WxT issue queue!Comment #6
sylus CreditAttribution: sylus commentedThanks everyone for the upstream fix as it is greatly appreciated :D
I did update our lock file for composer project with attribution:
https://github.com/drupalwxt/site-wxt/commit/8a5407fd0db0b7b54b37ad478bb...
Comment #7
DieterHolvoet CreditAttribution: DieterHolvoet as a volunteer commentedThe fix in
consolidation/annotated-command
will need to be reverted because it turned out to be a backwards compatibility break. I'll create a MR with a fix here.Comment #9
DieterHolvoet CreditAttribution: DieterHolvoet as a volunteer commentedComment #10
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedI prefer to keep the restriction in Drush. See https://github.com/drush-ops/drush/pull/5295. If that PR doesn't get merged and released into a stable version of Drush before the next stable release of the Annotated Command library, then you may apply the suggested fix here as a workaround. Otherwise, it shouldn't be necessary.
Comment #11
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedThe Annotated Command library 4.6.1 was just released, which reverted the backwards-compatibility break introduced by the change that originally fixed this problem. Drush is not going to remediate; modules will be allowed to override command files if they wish. That means that this bug will come back. I recommend resolving as suggested in #8.
Comment #13
sylus CreditAttribution: sylus commentedThank you so much for this and even updating our codebase. You both are so awesome and really appreciate your time :)
Committed and attributed!
Comment #14
moshe weitzman CreditAttribution: moshe weitzman commentedDoes't Wxtcex class need a contructor so that
$this->configExportCommands
gets set?