LogicException: The database connection is not serializable. This probably means you are serializing an object that has an indirect reference to the database connection.

Created on 25 January 2023, over 1 year ago
Updated 6 September 2023, 9 months ago

Problem/Motivation

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 2040 of web/core/lib/Drupal/Core/Database/Connection.php).

Steps to reproduce

  • Install Search API MeiliSearch Module
  • Navigate to Configuration >> Search and metadata >> Search API
  • Click on Add server
  • Enter Server name and select backend as MeiliSearch and Hit Save
  • Throws below error.

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 2040 of core/lib/Drupal/Core/Database/Connection.php).

serialize() (Line: 14)
Drupal\Component\Serialization\PhpSerialize::encode() (Line: 111)
Drupal\Core\KeyValueStore\DatabaseStorageExpirable->doSetWithExpire() (Line: 127)
Drupal\Core\KeyValueStore\DatabaseStorageExpirable->setWithExpire() (Line: 197)
Drupal\Core\Form\FormCache->setCache() (Line: 461)
Drupal\Core\Form\FormBuilder->setCache() (Line: 439)
Drupal\Core\Form\FormBuilder->rebuildForm() (Line: 631)
Drupal\Core\Form\FormBuilder->processForm() (Line: 323)
Drupal\Core\Form\FormBuilder->buildForm() (Line: 73)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 23)
Stack\StackedHttpKernel->handle() (Line: 713)
Drupal\Core\DrupalKernel->handle() (Line: 19)

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

🇮🇳India viswanathsai Hyderabad, Telangana

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

Comments & Activities

Production build 0.69.0 2024