Serialization Error in New Preview Section

Created on 22 December 2023, 11 months ago
Updated 20 January 2024, 10 months ago

Description

Following the recent addition of a 'preview' section to each Augmentor configuration page, we've encountered serialization errors. An example of such an error is as follows:

Object { message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 500\nDebugging information follows.\nPath: /admin/config/augmentors/129bc4db-e1b1-4f61-a836-b994f86c1f18?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-UlfRLDn3wE9B0p6pS0ptMWkeuWaTiU7-Lk3p1UHKsM4', Array, 21600) (Line: 127)\nDrupal\\Core\\KeyValueStore\\DatabaseStorageExpirable->setWithExpire('form-UlfRLDn3wE9B0p6pS0ptMWkeuWaTiU7-Lk3p1UHKsM4', Array, 21600) (Line: 193)\nDrupal\\Core\\Form\\FormCache->setCache('form-UlfRLDn3wE9B0p6pS0ptMWkeuWaTiU7-Lk3p1UHKsM4', Array, Object) (Line: 463)\nDrupal\\Core\\Form\\FormBuilder->setCache('form-UlfRLDn3wE9B0p6pS0ptMWkeuWaTiU7-Lk3p1UHKsM4', 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://ai-demo.convivial.io/core/misc/ajax.js?v=10.1.6:196:32\n@https://ai-demo.convivial.io/core/misc/ajax.js?v=10.1.6:1889:3\n" }

This error suggests an issue with serializing the database connection, potentially resolved by implementing the DependencySerializationTrait.

Proposed Resolution

  • Implement the DependencySerializationTrait in the Augmentor module.
  • This trait should be added to the AugmentorBase class to ensure all augmentors benefit from this fix.

Remaining Tasks

  • Integrate the DependencySerializationTrait into the AugmentorBase class.
  • Test to confirm that the serialization errors are resolved across all augmentors.
🐛 Bug report
Status

Fixed

Version

1.1

Component

Code

Created by

🇯🇵Japan eleonel Itoshima 🇯🇵

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024