Ajax error when trying to add or edit user picture

Created on 8 September 2024, 4 months ago
Updated 19 September 2024, 3 months ago

Problem/Motivation

After adding a ConstantContact field at /admin/config/people/accounts/fields the Picture field throws the following error when trying to add or remove a picture.

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

message: 
"\nAn AJAX HTTP error occurred.\nHTTP Result Code: 500\nDebugging information follows.\nPath: /user/1/edit?element_parents=user_picture/widget/0&ajax_form=1\nStatusText: error\nResponseText: 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)\nDrupal\\Component\\Serialization\\PhpSerialize::encode() (Line: 129)\nDrupal\\Core\\KeyValueStore\\DatabaseStorageExpirable->doSetWithExpire() (Line: 145)\nDrupal\\Core\\KeyValueStore\\DatabaseStorageExpirable->setWithExpire() (Line: 197)\nDrupal\\Core\\Form\\FormCache->setCache() (Line: 463)\nDrupal\\Core\\Form\\FormBuilder->setCache() (Line: 441)\nDrupal\\Core\\Form\\FormBuilder->rebuildForm() (Line: 633)\nDrupal\\Core\\Form\\FormBuilder->processForm() (Line: 326)\nDrupal\\Core\\Form\\FormBuilder->buildForm() (Line: 73)\nDrupal\\Core\\Controller\\FormController->getContentResult() (Line: 39)\nDrupal\\layout_builder\\Controller\\LayoutBuilderHtmlEntityFormController->getContentResult()\ncall_user_func_array() (Line: 123)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 638)\nDrupal\\Core\\Render\\Renderer->executeInRenderContext() (Line: 121)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)\nDrupal\\Core\\EventSubscriber\\EarlyRenderingControllerWrapperSubscriber->Drupal\\Core\\EventSubscriber\\{closure}() (Line: 181)\nSymfony\\Component\\HttpKernel\\HttpKernel->handleRaw() (Line: 76)\nSymfony\\Component\\HttpKernel\\HttpKernel->handle() (Line: 68)\nDrupal\\simple_oauth\\HttpMiddleware\\BasicAuthSwap->handle() (Line: 53)\nDrupal\\Core\\StackMiddleware\\Session->handle() (Line: 48)\nDrupal\\Core\\StackMiddleware\\KernelPreHandle->handle() (Line: 28)\nDrupal\\Core\\StackMiddleware\\ContentLength->handle() (Line: 32)\nDrupal\\big_pipe\\StackMiddleware\\ContentLength->handle() (Line: 106)\nDrupal\\page_cache\\StackMiddleware\\PageCache->pass() (Line: 85)\nDrupal\\page_cache\\StackMiddleware\\PageCache->handle() (Line: 53)\nAsm89\\Stack\\Cors->handle() (Line: 48)\nDrupal\\Core\\StackMiddleware\\ReverseProxyMiddleware->handle() (Line: 51)\nDrupal\\Core\\StackMiddleware\\NegotiationMiddleware->handle() (Line: 36)\nDrupal\\Core\\StackMiddleware\\AjaxPageState->handle() (Line: 51)\nDrupal\\Core\\StackMiddleware\\StackedHttpKernel->handle() (Line: 741)\nDrupal\\Core\\DrupalKernel->handle() (Line: 19)\n"
name
: 
"AjaxError"

Steps to reproduce

1. Open any user profile page in Edit mode
2. If no picture was added try uploading one or if picture exists try removing it.

Proposed resolution

Here are two links that might provide a solution to error:

View the 'office_hours_3399054-23_AjaxError.patch' for #23

๐Ÿ› Bug report
Status

Needs review

Version

3.1

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States alexi721

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024