While using the new preview feature on augmentors I can see the following error:
Uncaught
Object { message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 500\nDebugging information follows.\nPath: /admin/config/augmentors/3df65ec3-88ea-4f91-94a1-85fefdd8e230?ajax_form=1\nStatusText: error\nResponseText: The website encountered an unexpected error. Please try again later.LogicException: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution. in Drupal\\Core\\Database\\Connection->__sleep() (line 1712 of core/lib/Drupal/Core/Database/Connection.php). serialize(Array) (Line: 14)\nDrupal\\Component\\Serialization\\PhpSerialize::encode(Array) (Line: 111)\nDrupal\\Core\\KeyValueStore\\DatabaseStorageExpirable->doSetWithExpire('form-4Ug3QOVMs2Cuj6ZDXE17K1UWwZPm7Eb7Z99TT8BnjqE', Array, 21600) (Line: 127)\nDrupal\\Core\\KeyValueStore\\DatabaseStorageExpirable->setWithExpire('form-4Ug3QOVMs2Cuj6ZDXE17K1UWwZPm7Eb7Z99TT8BnjqE', Array, 21600) (Line: 193)\nDrupal\\Core\\Form\\FormCache->setCache('form-4Ug3QOVMs2Cuj6ZDXE17K1UWwZPm7Eb7Z99TT8BnjqE', Array, Object) (Line: 463)\nDrupal\\Core\\Form\\FormBuilder->setCache('form-4Ug3QOVMs2Cuj6ZDXE17K1UWwZPm7Eb7Z99TT8BnjqE', Array, Object) (Line: 441)\nDrupal\\Core\\Form\\FormBuilder->rebuildForm('augmentor_form', Object, Array) (Line: 633)\nDrupal\\Core\\Form\\FormBuilder->processForm('augmentor_form', Array, Object) (Line: 325)\nDrupal\\Core\\Form\\FormBuilder->buildForm(Object, Object) (Line: 73)\nDrupal\\Core\\Controller\\FormController->getContentResult(Object, Object)\ncall_user_func_array(Array, Array) (Line: 123)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 592)\nDrupal\\Core\\Render\\Renderer->executeInRenderContext(Object, Object) (Line: 124)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 181)\nSymfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object, 1) (Line: 76)\nSymfony\\Component\\HttpKernel\\HttpKernel->handle(Object, 1, 1) (Line: 58)\nDrupal\\Core\\StackMiddleware\\Session->handle(Object, 1, 1) (Line: 48)\nDrupal\\Core\\StackMiddleware\\KernelPreHandle->handle(Object, 1, 1) (Line: 106)\nDrupal\\page_cache\\StackMiddleware\\PageCache->pass(Object, 1, 1) (Line: 85)\nDrupal\\page_cache\\StackMiddleware\\PageCache->handle(Object, 1, 1) (Line: 48)\nDrupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)\nDrupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle(Object, 1, 1) (Line: 49)\nDrupal\\remove_http_headers\\StackMiddleware\\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 51)\nDrupal\\Core\\StackMiddleware\\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)\nDrupal\\Core\\DrupalKernel->handle(Object) (Line: 19)\n", name: "AjaxError", stack: "@https://convivial-demo.lndo.site:444/core/misc/ajax.js?v=10.1.6:196:32\n@https://convivial-demo.lndo.site:444/core/misc/ajax.js?v=10.1.6:1889:3\n" }
ā
message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 500\nDebugging information follows.\nPath: /admin/config/augmentors/3df65ec3-88ea-4f91-94a1-85fefdd8e230?ajax_form=1\nStatusText: error\nResponseText: The website encountered an unexpected error. Please try again later.LogicException: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection. Adjust your code so that is not necessary. Alternatively, look at DependencySerializationTrait as a temporary solution. in Drupal\\Core\\Database\\Connection->__sleep() (line 1712 of core/lib/Drupal/Core/Database/Connection.php). serialize(Array) (Line: 14)\nDrupal\\Component\\Serialization\\PhpSerialize::encode(Array) (Line: 111)\nDrupal\\Core\\KeyValueStore\\DatabaseStorageExpirable->doSetWithExpire('form-4Ug3QOVMs2Cuj6ZDXE17K1UWwZPm7Eb7Z99TT8BnjqE', Array, 21600) (Line: 127)\nDrupal\\Core\\KeyValueStore\\DatabaseStorageExpirable->setWithExpire('form-4Ug3QOVMs2Cuj6ZDXE17K1UWwZPm7Eb7Z99TT8BnjqE', Array, 21600) (Line: 193)\nDrupal\\Core\\Form\\FormCache->setCache('form-4Ug3QOVMs2Cuj6ZDXE17K1UWwZPm7Eb7Z99TT8BnjqE', Array, Object) (Line: 463)\nDrupal\\Core\\Form\\FormBuilder->setCache('form-4Ug3QOVMs2Cuj6ZDXE17K1UWwZPm7Eb7Z99TT8BnjqE', Array, Object) (Line: 441)\nDrupal\\Core\\Form\\FormBuilder->rebuildForm('augmentor_form', Object, Array) (Line: 633)\nDrupal\\Core\\Form\\FormBuilder->processForm('augmentor_form', Array, Object) (Line: 325)\nDrupal\\Core\\Form\\FormBuilder->buildForm(Object, Object) (Line: 73)\nDrupal\\Core\\Controller\\FormController->getContentResult(Object, Object)\ncall_user_func_array(Array, Array) (Line: 123)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 592)\nDrupal\\Core\\Render\\Renderer->executeInRenderContext(Object, Object) (Line: 124)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 181)\nSymfony\\Component\\HttpKernel\\HttpKernel->handleRaw(Object, 1) (Line: 76)\nSymfony\\Component\\HttpKernel\\HttpKernel->handle(Object, 1, 1) (Line: 58)\nDrupal\\Core\\StackMiddleware\\Session->handle(Object, 1, 1) (Line: 48)\nDrupal\\Core\\StackMiddleware\\KernelPreHandle->handle(Object, 1, 1) (Line: 106)\nDrupal\\page_cache\\StackMiddleware\\PageCache->pass(Object, 1, 1) (Line: 85)\nDrupal\\page_cache\\StackMiddleware\\PageCache->handle(Object, 1, 1) (Line: 48)\nDrupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)\nDrupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle(Object, 1, 1) (Line: 49)\nDrupal\\remove_http_headers\\StackMiddleware\\RemoveHttpHeadersMiddleware->handle(Object, 1, 1) (Line: 51)\nDrupal\\Core\\StackMiddleware\\StackedHttpKernel->handle(Object, 1, 1) (Line: 704)\nDrupal\\Core\\DrupalKernel->handle(Object) (Line: 19)\n"
ā
name: "AjaxError"
Solution
Use the DependencySerializationTrait: This trait provides a workaround for serializing objects with dependencies that themselves are not serializable (like the database connection). It does this by serializing a placeholder and then re-establishing the connection upon unserialization.