Created on 18 November 2024, 5 months ago

Downgrade to ^2.39 solves

Upgrade via composer to ^3.0 throws

The website encountered an unexpected error. Try again later.

TypeError: Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\Sql\{closure}(): Argument #1 ($definition) must be of type Drupal\Core\Field\FieldStorageDefinitionInterface, __PHP_Incomplete_Class given in Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\Sql\{closure}() (line 175 of core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php).
array_filter(Array, Object) (Line: 175)
Drupal\Core\Entity\Sql\DefaultTableMapping::create(Object, Array, '') (Line: 382)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->getCustomTableMapping(Object, Array) (Line: 357)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->getTableMapping() (Line: 204)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->initTableLayout() (Line: 189)
Drupal\Core\Entity\Sql\SqlContentEntityStorage->__construct(Object, Object, Object, Object, Object, Object, Object, Object) (Line: 149)
Drupal\Core\Entity\Sql\SqlContentEntityStorage::createInstance(Object, Object) (Line: 28)
Drupal\commerce\CommerceContentEntityStorage::createInstance(Object, Object) (Line: 280)
Drupal\Core\Entity\EntityTypeManager->createHandlerInstance('Drupal\commerce_payment\PaymentStorage', Object) (Line: 269)
Drupal\Core\Entity\EntityTypeManager->getHandler('commerce_payment', 'storage') (Line: 195)
Drupal\Core\Entity\EntityTypeManager->getStorage('commerce_payment') (Line: 107)
Drupal\views\EntityViewsData::createInstance(Object, Object) (Line: 58)
Drupal\commerce\CommerceEntityViewsData::createInstance(Object, Object) (Line: 280)
Drupal\Core\Entity\EntityTypeManager->createHandlerInstance('Drupal\commerce\CommerceEntityViewsData', Object) (Line: 269)
Drupal\Core\Entity\EntityTypeManager->getHandler('commerce_payment', 'views_data') (Line: 179)
views_views_data() (Line: 228)
Drupal\views\ViewsData->Drupal\views\{closure}(Object, 'views') (Line: 395)
Drupal\Core\Extension\ModuleHandler->invokeAllWith('views_data', Object) (Line: 68)
Drupal\hook_event_dispatcher\HookEventDispatcherModuleHandler->invokeAllWith('views_data', Object) (Line: 227)
Drupal\views\ViewsData->getData() (Line: 151)
Drupal\views\ViewsData->get('search_api_datasource_products_entity_commerce_product') (Line: 89)
Drupal\views\Plugin\ViewsHandlerManager->getHandler(Array, NULL) (Line: 896)
Drupal\views\Plugin\views\display\DisplayPluginBase->getHandlers('field') (Line: 1099)
Drupal\views\ViewExecutable->_initHandler('field', Array) (Line: 957)
Drupal\views\ViewExecutable->initHandlers() (Line: 2641)
Drupal\views\Plugin\views\display\DisplayPluginBase->viewExposedFormBlocks() (Line: 37)
Drupal\views\Plugin\Block\ViewsExposedFilterBlock->build() (Line: 171)
Drupal\block\BlockViewBuilder::preRender(Array)
call_user_func_array('Drupal\block\BlockViewBuilder::preRender', Array) (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback('Drupal\block\BlockViewBuilder::preRender', Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725 ', 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 870)
Drupal\Core\Render\Renderer->doCallback('#pre_render', 'Drupal\block\BlockViewBuilder::preRender', Array) (Line: 432)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 476)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 61)
__TwigTemplate_988558b4d0f8c21d2c8111339b7317c2->doDisplay(Array, Array) (Line: 393)
Twig\Template->yield(Array, Array) (Line: 349)
Twig\Template->display(Array) (Line: 364)
Twig\Template->render(Array) (Line: 35)
Twig\TemplateWrapper->render(Array) (Line: 33)
twig_render_template('themes/adaptivetheme/at_core/templates/layout/row--header.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('row', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 476)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 52)
__TwigTemplate_51fe8496649571b40b32ecb1ac0e51e0->doDisplay(Array, Array) (Line: 393)
Twig\Template->yield(Array, Array) (Line: 349)
Twig\Template->display(Array) (Line: 364)
Twig\Template->render(Array) (Line: 35)
Twig\TemplateWrapper->render(Array) (Line: 33)
twig_render_template('themes/at_bigbay/templates/generated/page.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('page', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 476)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 112)
__TwigTemplate_3b6b3dae8569bf7a4f65edf2823207a9->doDisplay(Array, Array) (Line: 393)
Twig\Template->yield(Array, Array) (Line: 349)
Twig\Template->display(Array) (Line: 364)
Twig\Template->render(Array) (Line: 35)
Twig\TemplateWrapper->render(Array) (Line: 33)
twig_render_template('themes/adaptivetheme/at_core/templates/layout/html.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('html', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 158)
Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 153)
Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 2) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 2, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 2, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 2, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 2, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 2, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 2, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 2, 1) (Line: 52)
Drupal\crawler_rate_limit\CrawlerRateLimitMiddleware->handle(Object, 2, 1) (Line: 57)
Drupal\advban\AdvbanMiddleware->handle(Object, 2, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 2, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 2, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 2, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 2, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 2) (Line: 166)
Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->makeSubrequest(Object, '/system/403', 403) (Line: 112)
Drupal\Core\EventSubscriber\DefaultExceptionHtmlSubscriber->on403(Object) (Line: 109)
Drupal\Core\EventSubscriber\HttpExceptionSubscriberBase->onException(Object, 'kernel.exception', Object)
call_user_func(Array, Object, 'kernel.exception', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.exception') (Line: 239)
Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object, Object, 1) (Line: 91)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 52)
Drupal\crawler_rate_limit\CrawlerRateLimitMiddleware->handle(Object, 1, 1) (Line: 57)
Drupal\advban\AdvbanMiddleware->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

🐛 Bug report
Status

Active

Version

3.0

Component

Commerce

Created by

🇺🇸United States bobburns

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

Merge Requests

Comments & Activities

  • Issue created by @bobburns
  • 🇮🇱Israel jsacksick

    I recently experienced this when upgrading to D11 / Commerce 3 on a project... Unfortunately I can't remember how I fixed this... I think one of the update hooks was problematic.
    I think I also tried uninstalling the page_cache module / big pipe.

  • 🇺🇸United States bobburns

    It appears related to a database table modification for an entity id

    See for example https://www.drupal.org/project/group/issues/3381083 💬 Errors upgrading from 1.5 -> 2.1 (with config entities) Active

    Perhaps it won't happen on a fresh install of version 3 but hacking tables is beyond me, a database update to the install file or sql patch is needed it appears

  • 🇨🇭Switzerland Siegrist

    We have the same issue. Is there a consistent fix for this?

  • 🇭🇺Hungary czigor

    To sum up our findings with @siegrist:

    Since this commit commerce's BundleFieldDefinition got deprecated in favor of the implementation of the entity module. This happened 7 years ago.

    The issue is that the sites that existed before the deprecation might still have commerce's BundleFieldDefinition serialized in their field storage definition. See e.g. select * from key_value where collection='entity.definitions.installed' and name='commerce_payment_method.entity_type'; So when updating to DC 3.x these definitions start referring to a nonexistent class.

    This affects pretty much all payment method types, profile types and product types as well.

    @jsacksick Would it make sense for you to have an update hook in commerce core 2.x that updates these field storage definitions to use the entity module implementation instead? (Once you update to 3.x it's too late.) I haven't tried but just saving the entity type might recreate the field storage definitions as well.

  • 🇨🇭Switzerland Siegrist

    In this original issue, we did not implement a hook to replace the already installed storage configs.

    https://www.drupal.org/project/commerce/issues/2922811

    With this very low-level update hook, we can change the used BundleFieldDefinition as the commerce and entity versions have the same footprint.
    This way we don't need to implement it on the 2.x branch but can do it simply on the 3.x branch.

    /**
     * Update outdataed payment method cache for commerce 3.
     */
    function hook_update_xxxx() {
      $old_string = 'O:37:"Drupal\\commerce\\BundleFieldDefinition":5:';
      $new_string = 'O:35:"Drupal\\entity\\BundleFieldDefinition":5:';
    
      $escaped_old_string = \Drupal::database()->escapeLike($old_string);
      $escaped_new_string = \Drupal::database()->escapeLike($new_string);
    
      \Drupal::database()
        ->query(
          "UPDATE {key_value}
         SET value = REPLACE(value, '" . $escaped_old_string . "', '" . $escaped_new_string . "')"
        )->execute();
    }
    
  • Pipeline finished with Success
    about 1 month ago
    Total: 670s
    #430592
  • 🇮🇱Israel jsacksick

    hm... This update hook looks a bit risky, isn't there a way to condition the update. There is no "name" we can filter on?

  • 🇨🇭Switzerland Siegrist

    I am not sure in what entities may have used commerce\\BundleFieldDefinition. We might be able to filter by commerce, but it's then unclear that we find all occurrences in contrib and custom code.

  • 🇭🇺Hungary czigor

    We could definitely add something like WHERE collection='entity.definitions.installed' AND name LIKE %.field_storage_definitions'.

    My bigger concern is if this is too database specific or not. We might want to do a SELECT, do the replacement in php and do a separate UPDATE instead.

  • Pipeline finished with Success
    about 1 month ago
    Total: 554s
    #433525
  • Pipeline finished with Success
    about 1 month ago
    Total: 1363s
    #433557
  • Pipeline finished with Failed
    about 1 month ago
    Total: 726s
    #433647
Production build 0.71.5 2024