Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
After updating to 8.x-5.0-rc14, I'm getting:
# drush updb -y
The following updates are pending:
webform module :
8123 - Issue #2962442: Remove [webform-authenticated-user] token and use [current-user] token with clear value option.
8124 - Issue #2971207: Hidden Field updated values not being captured on Submit.
8125 - Issue #2966507: Start-to-finish documentation for showing Webforms in modals.
8126 - Issue #2973377: Make the previously saved messages customizable.
8127 - Issue #2974597: Enable default publishing status of new webforms.
8128 - Issue #2932893: Filter out closed forms in webform field.
8129 - Issue #2977378: Add 'exclude unselected checkboxes' from email notification and preview.
Do you wish to run all pending updates? (y/n): y
Performing webform_update_8123 [ok]
Performing webform_update_8124 [ok]
Performing webform_update_8125 [ok]
Performing webform_update_8126 [ok]
Performing webform_update_8127 [ok]
Performing webform_update_8128 [ok]
TypeError: Argument 1 passed to [error]
Drupal\webform\WebformTokenManager::__construct() must implement
interface Drupal\Core\Session\AccountInterface, instance of
Drupal\Core\Config\ConfigFactory given, called in
/var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php
on line 274 in Drupal\webform\WebformTokenManager->__construct()
(line 57 of
/var/www/html/modules/webform/src/WebformTokenManager.php) #0
/var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php(274):
Drupal\webform\WebformTokenManager->__construct(Object(Drupal\Core\Config\ConfigFactory),
Object(Drupal\Core\Extension\ModuleHandler),
Object(Drupal\Core\Theme\ThemeManager), Object(Drupal\token\Token))
#1
/var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php(171):
Drupal\Component\DependencyInjection\Container->createService(Array,
'webform.token_m...')
#2
/var/www/html/modules/webform/src/Plugin/WebformHandler/EmailWebformHandler.php(159):
Drupal\Component\DependencyInjection\Container->get('webform.token_m...')
#3
/var/www/html/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(21):
Drupal\webform\Plugin\WebformHandler\EmailWebformHandler::create(Object(Drupal\Core\DependencyInjection\Container),
Array, 'email', Array)
#4
/var/www/html/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(76):
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('email',
Array)
#5
/var/www/html/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php(81):
Drupal\Component\Plugin\PluginManagerBase->createInstance('email',
Array)
#6
/var/www/html/modules/webform/src/Plugin/WebformHandlerPluginCollection.php(30):
Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin('email')
#7
/var/www/html/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php(80):
Drupal\webform\Plugin\WebformHandlerPluginCollection->initializePlugin('email')
#8
/var/www/html/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php(148):
Drupal\Component\Plugin\LazyPluginCollection->get('email')
#9 /var/www/html/modules/webform/src/Entity/Webform.php(2077):
Drupal\Component\Plugin\LazyPluginCollection->getIterator()
#10 /var/www/html/modules/webform/includes/webform.install.inc(167):
Drupal\webform\Entity\Webform->getHandlers()
#11
/var/www/html/modules/webform/includes/webform.install.update.inc(2261):
_webform_update_webform_handler_configuration('Drupal\\webform\\...')
#12
/root/.composer/vendor/drush/drush/commands/core/drupal/update.inc(60):
webform_update_8129(Array)
#13
/root/.composer/vendor/drush/drush/commands/core/drupal/batch.inc(163):
drush_update_do_one('webform', 8129, Array,
Object(DrushBatchContext))
#14
/root/.composer/vendor/drush/drush/commands/core/drupal/batch.inc(111):
_drush_batch_worker()
#15 /root/.composer/vendor/drush/drush/includes/batch.inc(98):
_drush_batch_command('25213')
#16
/root/.composer/vendor/drush/drush/commands/core/drupal/update.inc(230):
drush_batch_command('25213')
#17
/root/.composer/vendor/drush/drush/commands/core/core.drush.inc(1227):
_update_batch_command('25213')
#18 /root/.composer/vendor/drush/drush/includes/command.inc(422):
drush_core_updatedb_batch_process('25213')
#19 /root/.composer/vendor/drush/drush/includes/command.inc(231):
_drush_invoke_hooks(Array, Array)
#20 /root/.composer/vendor/drush/drush/includes/command.inc(199):
drush_command('25213')
#21
/root/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67):
drush_dispatch(Array)
#22 /root/.composer/vendor/drush/drush/includes/preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#23 /root/.composer/vendor/drush/drush/drush.php(12): drush_main()
#24 {main}.
TypeError: Argument 1 passed to Drupal\webform\WebformTokenManager::__construct() must implement interface Drupal\Core\Session\AccountInterface, instance of Drupal\Core\Config\ConfigFactory given, called in /var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php on line 274 in /var/www/html/modules/webform/src/WebformTokenManager.php on line 57 #0 /var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php(274): Drupal\webform\WebformTokenManager->__construct(Object(Drupal\Core\Config\ConfigFactory), Object(Drupal\Core\Extension\ModuleHandler), Object(Drupal\Core\Theme\ThemeManager), Object(Drupal\token\Token))
#1 /var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php(171): Drupal\Component\DependencyInjection\Container->createService(Array, 'webform.token_m...')
#2 /var/www/html/modules/webform/src/Plugin/WebformHandler/EmailWebformHandler.php(159): Drupal\Component\DependencyInjection\Container->get('webform.token_m...')
#3 /var/www/html/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(21): Drupal\webform\Plugin\WebformHandler\EmailWebformHandler::create(Object(Drupal\Core\DependencyInjection\Container), Array, 'email', Array)
#4 /var/www/html/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(76): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('email', Array)
#5 /var/www/html/core/lib/Drupal/Core/Plugin/DefaultLazyPluginCollection.php(81): Drupal\Component\Plugin\PluginManagerBase->createInstance('email', Array)
#6 /var/www/html/modules/webform/src/Plugin/WebformHandlerPluginCollection.php(30): Drupal\Core\Plugin\DefaultLazyPluginCollection->initializePlugin('email')
#7 /var/www/html/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php(80): Drupal\webform\Plugin\WebformHandlerPluginCollection->initializePlugin('email')
#8 /var/www/html/core/lib/Drupal/Component/Plugin/LazyPluginCollection.php(148): Drupal\Component\Plugin\LazyPluginCollection->get('email')
#9 /var/www/html/modules/webform/src/Entity/Webform.php(2077): Drupal\Component\Plugin\LazyPluginCollection->getIterator()
#10 /var/www/html/modules/webform/includes/webform.install.inc(167): Drupal\webform\Entity\Webform->getHandlers()
#11 /var/www/html/modules/webform/includes/webform.install.update.inc(2261): _webform_update_webform_handler_configuration('Drupal\\webform\\...')
#12 /root/.composer/vendor/drush/drush/commands/core/drupal/update.inc(60): webform_update_8129(Array)
#13 /root/.composer/vendor/drush/drush/commands/core/drupal/batch.inc(163): drush_update_do_one('webform', 8129, Array, Object(DrushBatchContext))
#14 /root/.composer/vendor/drush/drush/commands/core/drupal/batch.inc(111): _drush_batch_worker()
#15 /root/.composer/vendor/drush/drush/includes/batch.inc(98): _drush_batch_command('25213')
#16 /root/.composer/vendor/drush/drush/commands/core/drupal/update.inc(230): drush_batch_command('25213')
#17 /root/.composer/vendor/drush/drush/commands/core/core.drush.inc(1227): _update_batch_command('25213')
#18 /root/.composer/vendor/drush/drush/includes/command.inc(422): drush_core_updatedb_batch_process('25213')
#19 /root/.composer/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#20 /root/.composer/vendor/drush/drush/includes/command.inc(199): drush_command('25213')
#21 /root/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#22 /root/.composer/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#23 /root/.composer/vendor/drush/drush/drush.php(12): drush_main()
#24 {main}
TypeError: Argument 1 passed to Drupal\webform\WebformTokenManager::__construct() must implement interface Drupal\Core\Session\AccountInterface, instance of Drupal\Core\Config\ConfigFactory given, called in /var/www/html/core/lib/Drupal/Component/DependencyInjection/Container.php on line 274 in Drupal\webform\WebformTokenManager->__construct() (line 57 of /var/www/html/modules/webform/src/WebformTokenManager.php).
Running drush updb -y again results in:
# drush updb -y
The following updates are pending:
webform module :
8129 - Issue #2977378: Add 'exclude unselected checkboxes' from email notification and preview.
Do you wish to run all pending updates? (y/n): y
Performing webform_update_8129 [ok]
# drush updb -y
No database updates required [success]
Comment | File | Size | Author |
---|---|---|---|
#18 | 2977856-18.patch | 2.67 KB | jrockowitz |
| |||
#14 | Screen Shot 2018-06-08 at 10.21.06 AM.png | 129.66 KB | jrockowitz |
#12 | 2977856-12.patch | 812 bytes | jrockowitz |
| |||
#5 | 2977856-5.patch | 449 bytes | jrockowitz |
|
Comments
Comment #2
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedCan try to clear your cache before running the updates.
Comment #3
alberto56 CreditAttribution: alberto56 at Dcycle commentedI'm confirming that my update script was not clearing the cache prior to running updb; I have added drush cr prior to drush updb -y in my script for future use. My database is now updated on all my instances so I can't confirm that that would fix the issue, though, but thanks for the tip!
Comment #4
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedWhat is bizarre is that drush should be clearing the caching before these update hooks are executed.
I have never seen any module having to manually clear the cache before database updates.
Comment #5
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI can't reproduce this issue.
My best guess is the call to_webform_update_webform_handler_configuration() is triggering the error.
Please try the attached patch but make sure NOT clear your cache when you switch to rc14.
Comment #6
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedHere are my steps attempting to reproduce this issue.
git checkout 8.x-5.0-rc12
git checkout 8.x-5.0-rc14
.drush updb
Notes
Comment #7
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedWhat version of Drush are you running?
drush --version
Comment #8
alberto56 CreditAttribution: alberto56 at Dcycle commentedI managed to reproduce this:
(1) use this version of Drush (not sure it makes a difference)
(2) brand new Drupal 8 site with token and webform 8.x-5.0-rc12
(3) drush en -y webform_ui token
(4) go to /admin/structure/webform/manage/contact/handlers/email_confirmation/edit
(5) in "to mail", put Custom To Mail Address, and put "[webform_submission:created]"
(6) drush cex -y # Export the config
(7) drush dl -y webform-8.x-5.0-rc14
(8) drush updb -y
Comment #9
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@alberto56 Does the patch fix the issue?
I think I have to rewrite _webform_update_webform_handler_configuration().
Comment #10
alberto56 CreditAttribution: alberto56 at Dcycle commentedYes, if I apply the patch between steps 7 and 8, the error no longer happens:
Comment #11
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedUsing #8 I can replicate the issue.
Instead of executing drush updb, which clears the cache, we can use the below command to continuously replicate the issue.
drush php-eval 'module_load_include('install', 'webform'); webform_update_8129()';
Comment #12
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commented@alberto56 Please review the attached patch.
Comment #13
alberto56 CreditAttribution: alberto56 at Dcycle commentedI tested this patch using the steps at #8 and with the patch, everything works fine, but without the patch I get the error. I will tentatively set this to RTBC with the caveat that I don't fully understand what's at play here, I just can say it works!
Thanks for your time on this.
Comment #14
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI think this might be a Drush specific issue because if I follow the steps from #8 but for (8) instead of executing
drush updb -y
, I open /update.php and execute the pending updates everything is fine.I am not seeing anyone else having this issue but the Webform module relies on a lot of services with dependency injections and changes to service definitions during an update is causing this issue.
Comment #15
johnny5th CreditAttribution: johnny5th at Encore Multimedia commentedRunning
drush php-eval 'module_load_include('install', 'webform'); webform_update_8129()';
fixed my database after the failed update from rc12 to rc14. 90% of my webforms were missing before running that.Comment #16
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThe key function/update that needs to be triggered is _webform_update_webform_settings(); which is included in webform_update_8128() and webform_update_8129().
You can also run
drush webform-repair
which executes _webform_update_webform_settings();Comment #17
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedThis is a core issue #2863986: Allow updating modules with new service dependencies
Comment #18
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedSince this is a core issue, implementing a temporary workaround seems like a reasonable solution.
The attached patch executes
\Drupal::service('kernel')->rebuildContainer();
before any calls are made to webform.* services.Comment #20
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedI committed the patch. Please download the latest dev release to review.
Comment #21
jrockowitz CreditAttribution: jrockowitz as a volunteer and at The Big Blue House commentedComment #23
garrettw CreditAttribution: garrettw at Encore Multimedia commentedWhen updating webform from rc12 to rc15 today (drupal 8.5.4, drush 8.1.16) I got the following similar error:
Naturally, running
drush updb
after that worked fine.