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...