Upgrade to 2.38 causes errors

Created on 12 February 2024, over 1 year ago

After upgrading Commerce 2.37 to 2.38 (Drupal 10.2.3, PHP 8.3) I get this PHP error in the frontned:

ArgumentCountError: Too few arguments to function Drupal\commerce_product\ContextProvider\ProductVariationContext::__construct(), 2 passed in [...]/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 3 expected in Drupal\commerce_product\ContextProvider\ProductVariationContext->__construct() (line 67 of modules/contrib/commerce/modules/product/src/ContextProvider/ProductVariationContext.php).

and this error in the admin:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "logger.channel.commerce_order". Did you mean one of these: "logger.channel.commerce_payment", "logger.channel.commerce_paypal"? in Drupal\Component\DependencyInjection\Container->get() (line 157 of core/lib/Drupal/Component/DependencyInjection/Container.php).

Do I need to upgrade anything else before upgrading Commerce? What am I missing?

🐛 Bug report
Status

Active

Version

2.38

Component

Commerce

Created by

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

Merge Requests

Comments & Activities

  • Issue created by @asters
  • After downgrading to 2.37 I was able to get to the error log page and get the backtrace, in case it helps:

    Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "logger.channel.commerce_order". Did you mean one of these: "logger.channel.commerce_payment", "logger.channel.commerce_paypal"? in Drupal\Component\DependencyInjection\Container->get() (line 157 of [...]/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php).
    
    #0 [...]/public_html/modules/contrib/commerce/modules/order/src/OrderStorage.php(62): Drupal\Component\DependencyInjection\Container->get()
    #1 [...]/public_html/core/lib/Drupal/Core/Entity/EntityTypeManager.php(273): Drupal\commerce_order\OrderStorage::createInstance()
    #2 [...]/public_html/core/lib/Drupal/Core/Entity/EntityTypeManager.php(262): Drupal\Core\Entity\EntityTypeManager->createHandlerInstance()
    #3 [...]/public_html/core/lib/Drupal/Core/Entity/EntityTypeManager.php(192): Drupal\Core\Entity\EntityTypeManager->getHandler()
    #4 [...]/public_html/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php(323): Drupal\Core\Entity\EntityTypeManager->getStorage()
    #5 [...]/public_html/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php(261): Drupal\Core\Entity\EntityDefinitionUpdateManager->requiresEntityStorageSchemaChanges()
    #6 [...]/public_html/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php(88): Drupal\Core\Entity\EntityDefinitionUpdateManager->getChangeList()
    #7 [...]/public_html/core/modules/system/system.install(963): Drupal\Core\Entity\EntityDefinitionUpdateManager->getChangeSummary()
    #8 [internal function]: system_requirements()
    #9 [...]/public_html/core/lib/Drupal/Core/Extension/ModuleHandler.php(409): call_user_func_array()
    #10 [...]/public_html/core/lib/Drupal/Core/Extension/ModuleHandler.php(388): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
    #11 [...]/public_html/core/lib/Drupal/Core/Extension/ModuleHandler.php(408): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
    #12 [...]/public_html/core/modules/system/src/SystemManager.php(109): Drupal\Core\Extension\ModuleHandler->invokeAll()
    #13 [...]/public_html/core/modules/system/src/SystemManager.php(93): Drupal\system\SystemManager->listRequirements()
    #14 [...]/public_html/core/modules/system/src/Controller/SystemController.php(123): Drupal\system\SystemManager->checkRequirements()
    #15 [internal function]: Drupal\system\Controller\SystemController->overview()
    #16 [...]/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
    #17 [...]/public_html/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #18 [...]/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext()
    #19 [...]/public_html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
    #20 [...]/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
    #21 [...]/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #22 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
    #23 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #24 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #25 [...]/public_html/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
    #26 [...]/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
    #27 [...]/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
    #28 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #29 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #30 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #31 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
    #32 [...]/public_html/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
    #33 [...]/public_html/index.php(19): Drupal\Core\DrupalKernel->handle()
    #34 {main}
    
    ArgumentCountError: Too few arguments to function Drupal\commerce_product\ContextProvider\ProductVariationContext::__construct(), 2 passed in [...]/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 3 expected in Drupal\commerce_product\ContextProvider\ProductVariationContext->__construct() (line 67 of [...]/public_html/modules/contrib/commerce/modules/product/src/ContextProvider/ProductVariationContext.php).
    
    #0 [...]/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\commerce_product\ContextProvider\ProductVariationContext->__construct()
    #1 [...]/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
    #2 [...]/public_html/core/lib/Drupal/Core/Plugin/Context/LazyContextRepository.php(89): Drupal\Component\DependencyInjection\Container->get()
    #3 [...]/public_html/core/lib/Drupal/Core/ParamConverter/EntityConverter.php(141): Drupal\Core\Plugin\Context\LazyContextRepository->getAvailableContexts()
    #4 [...]/public_html/core/lib/Drupal/Core/ParamConverter/ParamConverterManager.php(100): Drupal\Core\ParamConverter\EntityConverter->convert()
    #5 [...]/public_html/core/lib/Drupal/Core/Routing/Enhancer/ParamConversionEnhancer.php(45): Drupal\Core\ParamConverter\ParamConverterManager->convert()
    #6 [...]/public_html/core/lib/Drupal/Core/Routing/Router.php(270): Drupal\Core\Routing\Enhancer\ParamConversionEnhancer->enhance()
    #7 [...]/public_html/core/lib/Drupal/Core/Routing/Router.php(150): Drupal\Core\Routing\Router->applyRouteEnhancers()
    #8 [...]/public_html/core/lib/Drupal/Core/Routing/AccessAwareRouter.php(90): Drupal\Core\Routing\Router->matchRequest()
    #9 [...]/vendor/symfony/http-kernel/EventListener/RouterListener.php(105): Drupal\Core\Routing\AccessAwareRouter->matchRequest()
    #10 [internal function]: Symfony\Component\HttpKernel\EventListener\RouterListener->onKernelRequest()
    #11 [...]/public_html/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
    #12 [...]/vendor/symfony/http-kernel/HttpKernel.php(157): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
    #13 [...]/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
    #14 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
    #15 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
    #16 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
    #17 [...]/public_html/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
    #18 [...]/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
    #19 [...]/public_html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
    #20 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\page_cache\StackMiddleware\PageCache->handle()
    #21 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
    #22 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
    #23 [...]/public_html/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
    #24 [...]/public_html/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
    #25 [...]/public_html/index.php(19): Drupal\Core\DrupalKernel->handle()
    #26 {main}
  • Status changed to Closed: cannot reproduce over 1 year ago
  • 🇮🇱Israel jsacksick

    Please rebuild your caches...

  • First commit to issue fork.
  • 🇳🇴Norway truls1502 Oslo, Norway

    We experienced the same issue when upgrading to Commerce 2.40 (including 2.38) while migrating from Drupal 9 to Drupal 10.

    It seems likely that #3418825 🐛 Exception logging is not working due to a typo in doOrderPreSave() Fixed might be the root cause, but I haven't fully investigated it. However, we still need to ensure that logger.channel.commerce_order exists, especially in CI/CD pipelines and production environments where developers do not have access to run drush cache:rebuild.

    We have created a simple patch that ensures the logger is always registered before use in OrderStorage::createInstance(), preventing pipeline failures.

    Would it be possible to integrate this fix? 🚀

  • Pipeline finished with Failed
    5 months ago
    Total: 601s
    #418807
  • Status changed to Needs review 3 days ago
    • jsacksick committed 01491987 on 3.x
      Issue #3420887 by truls1502, asters, jsacksick: Upgrade to 2.38 causes...
  • 🇮🇱Israel jsacksick

    This is quite outdated, but committed this to 3.x. Commerce 2.x is no longer actively maintained. Not sure if the fix is still relevant, but it should be harmless.

Production build 0.71.5 2024