0

When attempting to configure Checkout Flow instances (eg, /admin/commerce/config/checkout-flows/manage/default) clicking on the 'Settings' (cog) icon for any of the panes generates an 'AssertionError' and the settings cannot be altered.

AssertionError: The container was serialized. in assert() (line 28 of /app/web/core/lib/Drupal/Core/DependencyInjection/Container.php)  
#0 /app/web/core/lib/Drupal/Core/DependencyInjection/Container.php(28): assert(false, 'The container w...')
#1 [internal function]: Drupal\Core\DependencyInjection\Container->__sleep()
#2 /app/web/core/lib/Drupal/Component/Serialization/PhpSerialize.php(14): serialize(Array)
#3 /app/web/core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php(80): Drupal\Component\Serialization\PhpSerialize::encode(Array)
#4 /app/web/core/lib/Drupal/Core/Form/FormCache.php(197): Drupal\Core\KeyValueStore\DatabaseStorageExpirable->setWithExpire('form-GQXUq0kLih...', Array, 21600)
#5 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(459): Drupal\Core\Form\FormCache->setCache('form-GQXUq0kLih...', Array, Object(Drupal\Core\Form\FormState))
#6 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(437): Drupal\Core\Form\FormBuilder->setCache('form-GQXUq0kLih...', Array, Object(Drupal\Core\Form\FormState))
#7 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(629): Drupal\Core\Form\FormBuilder->rebuildForm('commerce_checko...', Object(Drupal\Core\Form\FormState), Array)
#8 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(321): Drupal\Core\Form\FormBuilder->processForm('commerce_checko...', Array, Object(Drupal\Core\Form\FormState))
#9 /app/web/core/lib/Drupal/Core/Controller/FormController.php(91): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\commerce_checkout\Form\CheckoutFlowForm), Object(Drupal\Core\Form\FormState))
#10 [internal function]: Drupal\Core\Controller\FormController->getContentResult(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\Core\Routing\RouteMatch))
#11 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#12 /app/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#13 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#14 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#15 /app/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#16 /app/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#17 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 /app/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#25 /app/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#26 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#27 {main}

This behaviour is not seen on other Drupal forms across the site, including other pieces of Commerce, so the assumption is that the cause is the Checkout module. Where similar errors have been reported elsewhere in Drupal, it's usually down to the Controller class not using DependencySerializationTrait, but this seems to be implemented in /commerce/modules/checkout/src/Controller/CheckoutController.php

The bad news is that I cannot replicate it: rolled another quick site using just Drupal 8.9.9 and Commerce 8.x-2.21 and the expected behaviour is working correctly.

Proposed resolution

I've no idea what's causing this, and whether it is a config issue, or an issue with the code. As with every other Drupal site, there are lots of other modules, but it's knowing where to start...

6
  • Make a db backup and start disabling custom and contrib modules related to commerce that are not part/sub modules of the commerce module.
    – No Sssweat
    Commented Nov 25, 2020 at 22:46
  • Also make sure the commerce module is up to date and there is nothing to update when you go to /update.php
    – No Sssweat
    Commented Nov 25, 2020 at 22:48
  • Thanks - site was pretty much up to date. Biggest issue with disabling modules is that many Commerce-related ones can't be uninstalled - even if all order/cart data is deleted. Currently trying to uninstall Commerce Recurring, which is proving difficult
    – Rob Carr
    Commented Nov 26, 2020 at 14:15
  • Very similar to LogicException: The database connection is not serializable - when I try to open any “gear” on checkout flow page? maybe one of the answers there will help you.
    – No Sssweat
    Commented Nov 26, 2020 at 14:22
  • 1
    Following through the threads you suggested, it seems that there is an unintended consequence from the mail_login module. As soon as it is disabled, then normal behaviour is restored to Commerce Checkout flow forms. See d.o issue at drupal.org/project/mail_login/issues/3181217 While it's not a solution, it allows me to get back to site config and building for the moment.
    – Rob Carr
    Commented Nov 27, 2020 at 10:42

1 Answer 1

1

In my case it was due to a problem with mail_login module.

Patch at https://www.drupal.org/project/mail_login/issues/3161437

Seems to be a recurring problem with modules that are missing DependencySerializationTrait

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.