TypeError: Drupal\commerce_fedex\Packer\CommerceFedExPacker::__construct(): Argument #2 ($string_translation)

Created on 18 March 2024, 9 months ago

Update to a crash

TypeError: Drupal\commerce_fedex\Packer\CommerceFedExPacker::__construct(): Argument #2 ($string_translation) must be of type Drupal\Core\StringTranslation\TranslationInterface, Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher given, called in /var/www/public_html/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\commerce_fedex\Packer\CommerceFedExPacker->__construct() (line 46 of modules/commerce_fedex/src/Packer/CommerceFedExPacker.php).
Drupal\Component\DependencyInjection\Container->createService(Array, 'commerce_fedex.commerce_fedex_packer') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('commerce_fedex.commerce_fedex_packer', 1) (Line: 440)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 273)
Drupal\Component\DependencyInjection\Container->createService(Array, 'commerce_shipping.packer_manager') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('commerce_shipping.packer_manager', 1) (Line: 440)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 237)
Drupal\Component\DependencyInjection\Container->createService(Array, 'commerce_shipping.order_manager') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('commerce_shipping.order_manager', 1) (Line: 440)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 237)
Drupal\Component\DependencyInjection\Container->createService(Array, 'commerce_shipping.early_order_processor') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('commerce_shipping.early_order_processor', 1) (Line: 440)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 273)
Drupal\Component\DependencyInjection\Container->createService(Array, 'commerce_order.order_refresh') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('commerce_order.order_refresh') (Line: 60)
Drupal\commerce_order\OrderStorage::createInstance(Object, Object) (Line: 277)
Drupal\Core\Entity\EntityTypeManager->createHandlerInstance('Drupal\commerce_order\OrderStorage', Object) (Line: 266)
Drupal\Core\Entity\EntityTypeManager->getHandler('commerce_order', 'storage') (Line: 192)
Drupal\Core\Entity\EntityTypeManager->getStorage('commerce_order') (Line: 69)
Drupal\commerce_cart\CartProvider->__construct(Object, Object, Object, Object) (Line: 259)
Drupal\Component\DependencyInjection\Container->createService(Array, 'commerce_cart.cart_provider') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('commerce_cart.cart_provider') (Line: 64)
Drupal\commerce_cart_blocks\Plugin\Block\CartBlockBase::create(Object, Array, 'commerce_cart_blocks_cart', Array) (Line: 21)
Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('commerce_cart_blocks_cart', Array) (Line: 76)
Drupal\Component\Plugin\PluginManagerBase->createInstance('commerce_cart_blocks_cart', Array) (Line: 62)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->initializePlugin('commerce_cart_blocks_cart') (Line: 57)
Drupal\block\BlockPluginCollection->initializePlugin('commerce_cart_blocks_cart') (Line: 80)
Drupal\Component\Plugin\LazyPluginCollection->get('commerce_cart_blocks_cart') (Line: 45)
Drupal\block\BlockPluginCollection->get('commerce_cart_blocks_cart') (Line: 83)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->setConfiguration(Array) (Line: 99)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->addInstanceId('commerce_cart_blocks_cart', Array) (Line: 55)
Drupal\Core\Plugin\DefaultSingleLazyPluginCollection->__construct(Object, 'commerce_cart_blocks_cart', Array) (Line: 34)
Drupal\block\BlockPluginCollection->__construct(Object, 'commerce_cart_blocks_cart', Array, 'at_bigbay_cart') (Line: 156)
Drupal\block\Entity\Block->getPluginCollection() (Line: 145)
Drupal\block\Entity\Block->getPlugin() (Line: 118)
Drupal\block\BlockAccessControlHandler->checkAccess(Object, 'view', Object) (Line: 109)
Drupal\Core\Entity\EntityAccessControlHandler->access(Object, 'view', Object, 1) (Line: 329)
Drupal\Core\Entity\EntityBase->access('view', NULL, 1) (Line: 63)
Drupal\block\BlockRepository->getVisibleBlocksPerRegion(Array) (Line: 137)
Drupal\block\Plugin\DisplayVariant\BlockPageVariant->build() (Line: 270)
Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
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, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
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: 704)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

🐛 Bug report
Status

Active

Version

2.0

Component

Code

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
  • Status changed to Needs review 9 months ago
  • 🇮🇳India abhishek_virasat

    I removed "use StringTranslationTrait" and its working for me. created Patch.

  • Status changed to Postponed: needs info 19 days ago
  • 🇺🇸United States rhovland Oregon

    The StringTranslationTrait is an essential component to allow for translations into other languages. Removing it is not an acceptable fix.

    I am unable to reproduce this error. Can you provide more information about how to reproduce it? Are you using current versions of Drupal, commerce, and commerce shipping?

  • First commit to issue fork.
  • Merge request !29chore: remove unnecessary use → (Open) created by mikelutz
  • 🇺🇸United States mikelutz Michigan, USA

    The StringTranslationTrait is an essential component to allow for translations into other languages. Removing it is not an acceptable fix.

    You are 2/3 correct. The StringTranslationTrait is an essential component to allow for translations into other languages. It is not a fix for the original issue here, because the trait has nothing to do with that error. The signature of the packer service was changed between 8.x-1.0-beta3 and 8.x-1.0-rc1. The error came from updating the code without clearing the cache. At some point while modifying the files, OP must have cleared the cache which caused the problem to go away.

    However, It is acceptable to remove this. Our packer doesn't directly use string translation, and the default packer that it extends from already uses this trait, so there is no need to use it a second time here.

Production build 0.71.5 2024