- Issue created by @jura.khrapunov
- πΊπΈUnited States kevinquillen
This has never been tried under Site Studio, at least not by me.
- πΊπΈUnited States jura.khrapunov
We are getting the same result with the text editor outside of the Site Studio (body field)
- πΊπΈUnited States kevinquillen
You'll have to provide details, your AI provider, and your composer.json on how to replicate this, as I have not seen this error in Drupal 10.3 or 11.
- πΊπΈUnited States jura.khrapunov
Sure:
AI provider: OpenAI
Drupal: 10.3.5
Composer.json: https://dev.azure.com/undp-online-digital/Acquia/_git/Acquia?version=GBf...
Installed AI submodules modules (from core.extension):
ai
ai_api_explorer
ai_assistant_api
ai_chatbot
ai_ckeditor
ai_content
ai_logging
ai_translate - πΊπΈUnited States kevinquillen
There is a ton to unpack in that composer.json. Are you really using Site Studio, Panels, Page Manager, and Acquia Lightning altogether?
- πΊπΈUnited States kevinquillen
From what I could find on the form error with #ajax, it seems like it is similar to this. But its hard to know "what" other than something could be altering forms that we are unaware of.
π 'The container was serialized' error when specifying an #ajax callback for a form Active
- πΊπΈUnited States jura.khrapunov
@kevinquillen, yes we do use all those modules - it is a shared codebase for all sites my organization is managing through the Acquia Site Factory.
But what I can attest for is that the same WYSIWYG editor has other plugins utilizing ajax form submissions (Linkit, Media library, custom plugins) which are working just fine.
Any suggestions how I can debug the issue locally?
- πΊπΈUnited States jura.khrapunov
After some digging I disabled PHP's zend.assertions in local environment to uncloak the error and now getting:
The website encountered an unexpected error. 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 1920 of core/lib/Drupal/Core/Database/Connection.php). serialize() (Line: 14) Drupal\Component\Serialization\PhpSerialize::encode() (Line: 129) Drupal\Core\KeyValueStore\DatabaseStorageExpirable->doSetWithExpire() (Line: 145) Drupal\Core\KeyValueStore\DatabaseStorageExpirable->setWithExpire() (Line: 193) Drupal\Core\Form\FormCache->setCache() (Line: 463) Drupal\Core\Form\FormBuilder->setCache() (Line: 441) Drupal\Core\Form\FormBuilder->rebuildForm() (Line: 633) Drupal\Core\Form\FormBuilder->processForm() (Line: 326) 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: 638) Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181) Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53) Drupal\Core\StackMiddleware\Session->handle() (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28) Drupal\Core\StackMiddleware\ContentLength->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: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741) Drupal\Core\DrupalKernel->handle() (Line: 19)
I just installed the AI module on an existing site, and I am also receiving this error. AI text formatting with CK editor does not work at all on that site. I am not receiving this error on other websites using the AI modules.
My error:
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 1920 of /var/www/html/web/core/lib/Drupal/Core/Database/Connection.php).
Severity Error
Operations
Backtrace
#0 [internal function]: Drupal\Core\Database\Connection->__sleep()
#1 /var/www/html/web/core/lib/Drupal/Component/Serialization/PhpSerialize.php(14): serialize()
#2 /var/www/html/web/core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php(129): Drupal\Component\Serialization\PhpSerialize::encode()
#3 /var/www/html/web/core/lib/Drupal/Core/KeyValueStore/DatabaseStorageExpirable.php(145): Drupal\Core\KeyValueStore\DatabaseStorageExpirable->doSetWithExpire()
#4 /var/www/html/web/core/lib/Drupal/Core/Form/FormCache.php(193): Drupal\Core\KeyValueStore\DatabaseStorageExpirable->setWithExpire()
#5 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(463): Drupal\Core\Form\FormCache->setCache()
#6 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(441): Drupal\Core\Form\FormBuilder->setCache()
#7 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(633): Drupal\Core\Form\FormBuilder->rebuildForm()
#8 /var/www/html/web/core/lib/Drupal/Core/Form/FormBuilder.php(326): Drupal\Core\Form\FormBuilder->processForm()
#9 /var/www/html/web/core/lib/Drupal/Core/Controller/FormController.php(73): Drupal\Core\Form\FormBuilder->buildForm()
#10 [internal function]: Drupal\Core\Controller\FormController->getContentResult()
#11 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#12 /var/www/html/web/core/lib/Drupal/Core/Render/Renderer.php(638): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#13 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
#14 /var/www/html/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#15 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#16 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#17 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle()
#18 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#19 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#20 /var/www/html/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#21 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#22 /var/www/html/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#23 /var/www/html/web/modules/contrib/advban/src/AdvbanMiddleware.php(57): Drupal\page_cache\StackMiddleware\PageCache->handle()
#24 /var/www/html/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\advban\AdvbanMiddleware->handle()
#25 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle()
#26 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#27 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#28 /var/www/html/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#29 /var/www/html/web/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#30 /var/www/html/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#31 {main}- π¬π§United Kingdom MrDaleSmith
Can this error be recreated on the dev version of the AI module?
- πΊπΈUnited States jura.khrapunov
Yes, this is consistently replicable for the Dev version as well:
The website encountered an unexpected error. 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 1920 of core/lib/Drupal/Core/Database/Connection.php). serialize() (Line: 14) Drupal\Component\Serialization\PhpSerialize::encode() (Line: 129) Drupal\Core\KeyValueStore\DatabaseStorageExpirable->doSetWithExpire() (Line: 145) Drupal\Core\KeyValueStore\DatabaseStorageExpirable->setWithExpire() (Line: 193) Drupal\Core\Form\FormCache->setCache() (Line: 463) Drupal\Core\Form\FormBuilder->setCache() (Line: 441) Drupal\Core\Form\FormBuilder->rebuildForm() (Line: 633) Drupal\Core\Form\FormBuilder->processForm() (Line: 326) 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: 638) Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97) Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181) Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76) Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53) Drupal\Core\StackMiddleware\Session->handle() (Line: 48) Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28) Drupal\Core\StackMiddleware\ContentLength->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: 36) Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51) Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741) Drupal\Core\DrupalKernel->handle() (Line: 19)
- π¬π§United Kingdom MrDaleSmith
Can't recreate this issue on a clean install of Drupal with the ai_ckeditor module installed and configured: generation, summary, tone and translation all work without generating error.
I am using an external amazon RDS database, in case that information helps. But I have a similar configuration on a site where this is working so I am not sure what the difference is.
- πΊπΈUnited States jura.khrapunov
I assume it is an interference with some other module installed.
@jbuttler can you share the list of installed/enabled modules (core.extension.yml in config export), or at least your composer.json?