localgovdrupal / localgov_workflows

Default editorial workflow for LocalGov Drupal content.
GNU General Public License v2.0
0 stars 1 forks source link

Throws error when installing module via drush config-import #2

Closed Boosmith closed 2 years ago

Boosmith commented 2 years ago

Hi

I've run into a problem where it throws an error when installing using drush config-import. It's fine when enabling the module via the command line drush en localgovdrupal_workflows

The error I am getting is `Import the listed configuration changes? (yes/no) [yes]:

[notice] Synchronized extensions: install dynamic_entity_reference. [notice] Synchronized extensions: install role_delegation. [notice] Synchronized extensions: install localgov_roles. [notice] Synchronized extensions: install preview_link. [notice] Synchronized extensions: install responsive_preview. [notice] Synchronized extensions: install scheduled_transitions.

1 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('localgov_workfl...', Array)

2 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(343): Drupal\Core\Extension\ModuleHandler->invoke('localgov_workfl...', 'install', Array)

3 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, false)

4 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(808): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, false)

5 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(572): Drupal\Core\Config\ConfigImporter->processExtension('module', 'install', 'localgov_workfl...')

6 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(509): Drupal\Core\Config\ConfigImporter->processExtensions(Array)

7 /app/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(336): Drupal\Core\Config\ConfigImporter->doSyncStep('processExtensio...', Array)

8 /app/vendor/drush/drush/includes/drush.inc(206): Drush\Drupal\Commands\config\ConfigImportCommands->doImport(Object(Drupal\Core\Config\StorageComparer))

9 /app/vendor/drush/drush/includes/drush.inc(197): drush_call_user_func_array(Array, Array)

10 /app/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(307): drush_op(Array, Object(Drupal\Core\Config\StorageComparer))

11 [internal function]: Drush\Drupal\Commands\config\ConfigImportCommands->import(NULL, Array)

12 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)

13 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))

14 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))

15 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))

16 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

17 /app/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

18 /app/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

19 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

20 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

21 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))

22 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)

23 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')

24 {main}.

Error: Call to a member function getTypePlugin() on null in /app/web/modules/contrib/localgov_workflows/localgov_workflows.install on line 19 #0 [internal function]: localgov_workflows_install(true)

1 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('localgov_workfl...', Array)

2 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(343): Drupal\Core\Extension\ModuleHandler->invoke('localgov_workfl...', 'install', Array)

3 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, false)

4 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(808): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, false)

5 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(572): Drupal\Core\Config\ConfigImporter->processExtension('module', 'install', 'localgov_workfl...')

6 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(509): Drupal\Core\Config\ConfigImporter->processExtensions(Array)

7 /app/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(336): Drupal\Core\Config\ConfigImporter->doSyncStep('processExtensio...', Array)

8 /app/vendor/drush/drush/includes/drush.inc(206): Drush\Drupal\Commands\config\ConfigImportCommands->doImport(Object(Drupal\Core\Config\StorageComparer))

9 /app/vendor/drush/drush/includes/drush.inc(197): drush_call_user_func_array(Array, Array)

10 /app/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(307): drush_op(Array, Object(Drupal\Core\Config\StorageComparer))

11 [internal function]: Drush\Drupal\Commands\config\ConfigImportCommands->import(NULL, Array)

12 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)

13 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))

14 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))

15 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))

16 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

17 /app/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

18 /app/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

19 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

20 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

21 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))

22 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)

23 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')

24 {main}

Error: Call to a member function getTypePlugin() on null in localgov_workflows_install() (line 19 of /app/web/modules/contrib/localgov_workflows/localgov_workflows.install).`

It looks to me like it's expecting the editorial workflow to already be there when it runs the code in the .install file.

It could be my mistake of course but I thought I better raise it.

Thanks

finnlewis commented 2 years ago

Hi @Boosmith ,

Thanks for reporting the issue!

To be honest, I've bever tried importing config in that way. I'll give it a go tomorrow and report back with what I find.

Many thanks,

Finn

Boosmith commented 2 years ago

Update to this issue...

I've tried going through the same process on a clean install of localgovdrupal and I am getting the same error on drush cim. I'll did the following:

  1. composer create-project --stability stable localgovdrupal/localgov-project localgov
  2. cd localgov && lando start
  3. lando drush si localgov -y
  4. lando db-export ../backups/database.sql
  5. lando drush en localgov_workflows -y
  6. lando drush cex
  7. lando drush sql-drop -y
  8. lando drush sql-cli < backups/database.sql
  9. lando drush cr
  10. lando drush cim Output from drush cim `+------------+-----------------------------------------+-----------+ | Collection | Config | Operation | +------------+-----------------------------------------+-----------+ | | scheduled_transitions.settings | Create | | | views.view.localgov_approvals_dashboard | Create | | | views.view.scheduled_transitions | Create | | | responsive_preview.device.galaxy_s9 | Create | | | responsive_preview.device.galaxy_tab_s4 | Create | | | responsive_preview.device.ipad_pro | Create | | | responsive_preview.device.iphone_xs | Create | | | responsive_preview.device.iphone_xs_max | Create | | | responsive_preview.device.large | Create | | | responsive_preview.device.medium | Create | | | preview_link.settings | Create | | | responsive_preview.device.small | Create | | | workflows.workflow.localgov_editorial | Create | | | core.extension | Update | | | user.role.localgov_author | Update | | | user.role.localgov_contributor | Update | | | user.role.localgov_editor | Update | +------------+-----------------------------------------+-----------+

    Import the listed configuration changes? (yes/no) [yes]:

    [notice] Synchronized extensions: install dynamic_entity_reference. [notice] Synchronized extensions: install preview_link. [notice] Synchronized extensions: install responsive_preview. [notice] Synchronized extensions: install scheduled_transitions.

    1 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array("localgov_workfl...", Array)

    2 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(343): Drupal\Core\Extension\ModuleHandler->invoke("localgov_workfl...", "install", Array)

    3 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, false)

    4 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(808): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, false)

    5 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(572): Drupal\Core\Config\ConfigImporter->processExtension("module", "install", "localgov_workfl...")

    6 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(509): Drupal\Core\Config\ConfigImporter->processExtensions(Array)

    7 /app/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(336): Drupal\Core\Config\ConfigImporter->doSyncStep("processExtensio...", Array)

    8 /app/vendor/drush/drush/includes/drush.inc(206): Drush\Drupal\Commands\config\ConfigImportCommands->doImport(Object(Drupal\Core\Config\StorageComparer))

    9 /app/vendor/drush/drush/includes/drush.inc(197): drush_call_user_func_array(Array, Array)

    10 /app/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(307): drush_op(Array, Object(Drupal\Core\Config\StorageComparer))

    11 [internal function]: Drush\Drupal\Commands\config\ConfigImportCommands->import(NULL, Array)

    12 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)

    13 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))

    14 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))

    15 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))

    16 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    17 /app/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    18 /app/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    19 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    20 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    21 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))

    22 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)

    23 /app/vendor/drush/drush/drush(4): require("/app/vendor/dru...")

    24 {main}.

    Error: Call to a member function getTypePlugin() on null in /app/web/modules/contrib/localgov_workflows/localgov_workflows.install on line 19 #0 [internal function]: localgov_workflows_install(true)

    1 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array("localgov_workfl...", Array)

    2 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(343): Drupal\Core\Extension\ModuleHandler->invoke("localgov_workfl...", "install", Array)

    3 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, false)

    4 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(808): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, false)

    5 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(572): Drupal\Core\Config\ConfigImporter->processExtension("module", "install", "localgov_workfl...")

    6 /app/web/core/lib/Drupal/Core/Config/ConfigImporter.php(509): Drupal\Core\Config\ConfigImporter->processExtensions(Array)

    7 /app/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(336): Drupal\Core\Config\ConfigImporter->doSyncStep("processExtensio...", Array)

    8 /app/vendor/drush/drush/includes/drush.inc(206): Drush\Drupal\Commands\config\ConfigImportCommands->doImport(Object(Drupal\Core\Config\StorageComparer))

    9 /app/vendor/drush/drush/includes/drush.inc(197): drush_call_user_func_array(Array, Array)

    10 /app/vendor/drush/drush/src/Drupal/Commands/config/ConfigImportCommands.php(307): drush_op(Array, Object(Drupal\Core\Config\StorageComparer))

    11 [internal function]: Drush\Drupal\Commands\config\ConfigImportCommands->import(NULL, Array)

    12 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)

    13 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))

    14 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))

    15 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))

    16 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    17 /app/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    18 /app/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    19 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    20 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

    21 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))

    22 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)

    23 /app/vendor/drush/drush/drush(4): require("/app/vendor/dru...")

    24 {main}

    Error: Call to a member function getTypePlugin() on null in localgov_workflows_install() (line 19 of /app/web/modules/contrib/localgov_workflows/localgov_workflows.install). [warning] Drush command terminated abnormally.`

finnlewis commented 2 years ago

Thanks for the update @Boosmith

I can replicate this locally with a copy of your codebase and database.

I'll see if I can work out what's going on.

Copying @stephen-cox in case I can't and he's able to pick this up next week.

stephen-cox commented 2 years ago

@Boosmith There's a fix for this that would be good it you could test it and let me know if it solves the problem for you: See #8

The code changes are on the feature/2-error-installing-from-config-import branch of the localgov_workflows module, so you'll either need to check this branch out manually or install it with composer with something like:

composer require localgovdrupal/localgov_workflows:dev-feature/2-error-installing-from-config-import

Let me know how you get on. If you can confirm the changes in the branch work then we can get this fix merged and released.

Boosmith commented 2 years ago

@Boosmith There's a fix for this that would be good it you could test it and let me know if it solves the problem for you: See #8

The code changes are on the feature/2-error-installing-from-config-import branch of the localgov_workflows module, so you'll either need to check this branch out manually or install it with composer with something like:

composer require localgovdrupal/localgov_workflows:dev-feature/2-error-installing-from-config-import

Let me know how you get on. If you can confirm the changes in the branch work then we can get this fix merged and released.

Unfortunately @stephen-cox I get this error when trying to install. This was after running composer require localgovdrupal/localgov_workflows:dev-feature/2-error-installing-from-config-import --with-all-dependencies -vvv

lando drush en localgov_workflows                                                                  
The following module(s) will be enabled: localgov_workflows, preview_link, responsive_preview, scheduled_transitions, dynamic_entity_reference, localgov_roles

 Do you want to continue? (yes/no) [yes]:
 > 

 [error]  Error: Undefined class constant 'CONTRIBUTOR_ROLE' in localgov_workflows_localgov_roles_default() (line 60 of /app/web/modules/contrib/localgov_workflows/localgov_workflows.module) #0 [internal function]: localgov_workflows_localgov_roles_default()
#1 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('localgov_workfl...', Array)
#2 /app/web/modules/contrib/localgov_workflows/localgov_workflows.install(70): Drupal\Core\Extension\ModuleHandler->invokeAll('localgov_roles_...')
#3 [internal function]: localgov_workflows_install(false)
#4 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('localgov_workfl...', Array)
#5 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(328): Drupal\Core\Extension\ModuleHandler->invoke('localgov_workfl...', 'install', Array)
#6 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, true)
#7 /app/vendor/drush/drush/src/Drupal/Commands/pm/PmCommands.php(103): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, true)
#8 [internal function]: Drush\Drupal\Commands\pm\PmCommands->enable(Array, Array)
#9 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#10 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#12 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#13 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /app/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /app/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#20 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
#21 {main}. 
Error: Undefined class constant 'CONTRIBUTOR_ROLE' in /app/web/modules/contrib/localgov_workflows/localgov_workflows.module on line 60 #0 [internal function]: localgov_workflows_localgov_roles_default()
#1 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('localgov_workfl...', Array)
#2 /app/web/modules/contrib/localgov_workflows/localgov_workflows.install(70): Drupal\Core\Extension\ModuleHandler->invokeAll('localgov_roles_...')
#3 [internal function]: localgov_workflows_install(false)
#4 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('localgov_workfl...', Array)
#5 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(328): Drupal\Core\Extension\ModuleHandler->invoke('localgov_workfl...', 'install', Array)
#6 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, true)
#7 /app/vendor/drush/drush/src/Drupal/Commands/pm/PmCommands.php(103): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, true)
#8 [internal function]: Drush\Drupal\Commands\pm\PmCommands->enable(Array, Array)
#9 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#10 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#12 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#13 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /app/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /app/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#20 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
#21 {main}
Error: Undefined class constant &#039;CONTRIBUTOR_ROLE&#039; in localgov_workflows_localgov_roles_default() (line 60 of /app/web/modules/contrib/localgov_workflows/localgov_workflows.module).
 [warning] Drush command terminated abnormally.
stephen-cox commented 2 years ago

Can you try enabling the localgov_roles module first and then localgov_workflows

stephen-cox commented 2 years ago

Also make sure you've got the latest version of LocalGov Core installed, which is currently 2.1.0

Boosmith commented 2 years ago

Still throwing an error after enabling localgov_roles first with localgovdrupal/localgov v2.1.0

lando drush en localgov_workflows                                                                   
The following module(s) will be enabled: localgov_workflows, preview_link, responsive_preview, scheduled_transitions, dynamic_entity_reference

 Do you want to continue? (yes/no) [yes]:
 > 

 [error]  Error: Undefined class constant 'CONTRIBUTOR_ROLE' in localgov_events_localgov_roles_default() (line 51 of /app/web/modules/contrib/localgov_events/localgov_events.module) #0 [internal function]: localgov_events_localgov_roles_default()
#1 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('localgov_events...', Array)
#2 /app/web/modules/contrib/localgov_workflows/localgov_workflows.install(70): Drupal\Core\Extension\ModuleHandler->invokeAll('localgov_roles_...')
#3 [internal function]: localgov_workflows_install(false)
#4 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('localgov_workfl...', Array)
#5 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(343): Drupal\Core\Extension\ModuleHandler->invoke('localgov_workfl...', 'install', Array)
#6 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, true)
#7 /app/vendor/drush/drush/src/Drupal/Commands/pm/PmCommands.php(103): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, true)
#8 [internal function]: Drush\Drupal\Commands\pm\PmCommands->enable(Array, Array)
#9 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#10 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#12 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#13 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /app/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /app/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#20 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
#21 {main}. 
Error: Undefined class constant 'CONTRIBUTOR_ROLE' in /app/web/modules/contrib/localgov_events/localgov_events.module on line 51 #0 [internal function]: localgov_events_localgov_roles_default()
#1 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('localgov_events...', Array)
#2 /app/web/modules/contrib/localgov_workflows/localgov_workflows.install(70): Drupal\Core\Extension\ModuleHandler->invokeAll('localgov_roles_...')
#3 [internal function]: localgov_workflows_install(false)
#4 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('localgov_workfl...', Array)
#5 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(343): Drupal\Core\Extension\ModuleHandler->invoke('localgov_workfl...', 'install', Array)
#6 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, true)
#7 /app/vendor/drush/drush/src/Drupal/Commands/pm/PmCommands.php(103): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, true)
#8 [internal function]: Drush\Drupal\Commands\pm\PmCommands->enable(Array, Array)
#9 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#10 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#12 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#13 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /app/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /app/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#20 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
#21 {main}
Error: Undefined class constant &#039;CONTRIBUTOR_ROLE&#039; in localgov_events_localgov_roles_default() (line 51 of /app/web/modules/contrib/localgov_events/localgov_events.module).
 [warning] Drush command terminated abnormally.
stephen-cox commented 2 years ago

Hi @Boosmith, this a a bit odd. The LocalGov Roles module should be installed when doing a LocalGov site install and as long as you have the latest version of LocalGov Core (Roles is a sub module of Core) then it includes the RolesHelper class with these constants defined.

On a fresh install I couldn't use the Composer command I supplied above to install the fix and had to use an alias to get it to work. The following works for me.

composer create-project --stability dev localgovdrupal/localgov-project lgd
cd lgd
composer require localgovdrupal/localgov_workflows:"dev-feature/2-error-installing-from-config-import as 1"
lando start
lando drush si localgov -y
lando drush sql-dump > test.sql
lando drush en localgov_workflows -y
lando drush cex
lando drush sql-drop -y
lando drush sqlc < test.sql
lando drush cr
lando drush cim --yes

I have pushed a couple of small changes to the feature/2-error-installing-from-config-import branch, which shouldn't make much difference to the error your seeing, but would be good to test.

Boosmith commented 2 years ago

Still getting the same error while installing localgovdrupal/localgov_roles . Looks like the localgov_events module is expecting a CONTRIBUTOR_ROLE which doesn't exist. See output below.

NB. I won't have any more time to work on this now till after the bank holiday

lando drush en localgov_roles                                                                      
 [error]  Error: Undefined class constant 'CONTRIBUTOR_ROLE' in localgov_events_localgov_roles_default() (line 51 of /app/web/modules/contrib/localgov_events/localgov_events.module) #0 [internal function]: localgov_events_localgov_roles_default()
#1 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('localgov_events...', Array)
#2 /app/web/modules/contrib/localgov_core/modules/localgov_roles/localgov_roles.install(12): Drupal\Core\Extension\ModuleHandler->invokeAll('localgov_roles_...')
#3 [internal function]: localgov_roles_install(false)
#4 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('localgov_roles_...', Array)
#5 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(343): Drupal\Core\Extension\ModuleHandler->invoke('localgov_roles', 'install', Array)
#6 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, true)
#7 /app/vendor/drush/drush/src/Drupal/Commands/pm/PmCommands.php(103): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, true)
#8 [internal function]: Drush\Drupal\Commands\pm\PmCommands->enable(Array, Array)
#9 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#10 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#12 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#13 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /app/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /app/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#20 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
#21 {main}. 
Error: Undefined class constant 'CONTRIBUTOR_ROLE' in /app/web/modules/contrib/localgov_events/localgov_events.module on line 51 #0 [internal function]: localgov_events_localgov_roles_default()
#1 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(403): call_user_func_array('localgov_events...', Array)
#2 /app/web/modules/contrib/localgov_core/modules/localgov_roles/localgov_roles.install(12): Drupal\Core\Extension\ModuleHandler->invokeAll('localgov_roles_...')
#3 [internal function]: localgov_roles_install(false)
#4 /app/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(392): call_user_func_array('localgov_roles_...', Array)
#5 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(343): Drupal\Core\Extension\ModuleHandler->invoke('localgov_roles', 'install', Array)
#6 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install(Array, true)
#7 /app/vendor/drush/drush/src/Drupal/Commands/pm/PmCommands.php(103): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install(Array, true)
#8 [internal function]: Drush\Drupal\Commands\pm\PmCommands->enable(Array, Array)
#9 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#10 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#12 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(311): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#13 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /app/vendor/symfony/console/Application.php(1027): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /app/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /app/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /app/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /app/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
#20 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
#21 {main}
Error: Undefined class constant &#039;CONTRIBUTOR_ROLE&#039; in localgov_events_localgov_roles_default() (line 51 of /app/web/modules/contrib/localgov_events/localgov_events.module).
 [warning] Drush command terminated abnormally.
stephen-cox commented 2 years ago

@Boosmith I don't think I can get anywhere further with this without knowing more about the state of your codebase you're using. It might help if I can see your root composer.json, but I might need a DB to go with it if that alone doesn't help/

stephen-cox commented 2 years ago

@Boosmith I have managed to reproduce an error like this when running an older version of LocalGov Drupal. Can you confirm you still get the issue after running a composer update?

Boosmith commented 2 years ago

Hi @stephen-cox I'm still getting the error I'm afraid with localgovdrupal 2.1.2 and workflows 1.0.0. If I try and use the dev-feature/2-error-installing-from-config-import version then it wants to downgrade to localgovdrupal 2.1.1

I see that the https://github.com/localgovdrupal/localgov/issues/323 issue could be relevant, although at the moment I am back to the same error on drush cim that I had initially...

I am wondering if the best is to just to enable it manually and not do it via config-import. In theory, the config should all match so it shouldn't prove a problem going forward, but I haven't tested this out. I guess there is always the risk that it is storing up problems for the future though if I enable manually