skip to Main Content

i am upgrading magento 2.4.6-p3 to 2.4.7-p2
php version 8.2
on frontend iam facing:

1 exception(s):
Exception #0 (ReflectionException): Class "Auth" does not exist

Exception #0 (ReflectionException): Class "Auth" does not exist

#1 MagentoFrameworkCodeReaderClassReader->getConstructor() called at [vendor/magento/framework/ObjectManager/Definition/Runtime.php:50]
#2 MagentoFrameworkObjectManagerDefinitionRuntime->getParameters() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:100]
#3 MagentoFrameworkObjectManagerFactoryCompiled->create() called at [vendor/magento/framework/ObjectManager/ObjectManager.php:73]
#4 MagentoFrameworkObjectManagerObjectManager->get() called at [vendor/magento/module-customer/view/frontend/templates/js/customer-data.phtml:14]
#5 include() called at [vendor/magento/framework/View/TemplateEngine/Php.php:67]
#6 MagentoFrameworkViewTemplateEnginePhp->render() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#7 MagentoFrameworkViewTemplateEnginePhpInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#8 MagentoFrameworkViewTemplateEnginePhpInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#9 MagentoFrameworkViewTemplateEnginePhpInterceptor->___callPlugins() called at [generated/code/Magento/Framework/View/TemplateEngine/Php/Interceptor.php:23]
#10 MagentoFrameworkViewTemplateEnginePhpInterceptor->render() called at [vendor/magento/framework/View/Element/Template.php:263]
#11 MagentoFrameworkViewElementTemplate->fetchView() called at [vendor/magento/framework/View/Element/Template.php:293]
#12 MagentoFrameworkViewElementTemplate->_toHtml() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1128]
#13 MagentoFrameworkViewElementAbstractBlock->MagentoFrameworkViewElement{closure}() called at [vendor/magento/framework/View/Element/AbstractBlock.php:1132]
#14 MagentoFrameworkViewElementAbstractBlock->_loadCache() called at [vendor/magento/framework/View/Element/AbstractBlock.php:676]
#15 MagentoFrameworkViewElementAbstractBlock->toHtml() called at [vendor/magento/framework/View/Layout.php:578]
#16 MagentoFrameworkViewLayout->_renderBlock() called at [vendor/magento/framework/View/Layout.php:555]
#17 MagentoFrameworkViewLayout->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510]
#18 MagentoFrameworkViewLayout->renderElement() called at [vendor/magento/framework/View/Layout.php:606]
#19 MagentoFrameworkViewLayout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557]
#20 MagentoFrameworkViewLayout->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510]
#21 MagentoFrameworkViewLayout->renderElement() called at [vendor/magento/framework/View/Layout.php:606]
#22 MagentoFrameworkViewLayout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557]
#23 MagentoFrameworkViewLayout->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510]
#24 MagentoFrameworkViewLayout->renderElement() called at [vendor/magento/framework/View/Layout.php:606]
#25 MagentoFrameworkViewLayout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557]
#26 MagentoFrameworkViewLayout->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510]
#27 MagentoFrameworkViewLayout->renderElement() called at [vendor/magento/framework/View/Layout.php:606]
#28 MagentoFrameworkViewLayout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557]
#29 MagentoFrameworkViewLayout->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510]
#30 MagentoFrameworkViewLayout->renderElement() called at [vendor/magento/framework/View/Layout.php:606]
#31 MagentoFrameworkViewLayout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557]
#32 MagentoFrameworkViewLayout->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510]
#33 MagentoFrameworkViewLayout->renderElement() called at [vendor/magento/framework/View/Layout.php:606]
#34 MagentoFrameworkViewLayout->_renderContainer() called at [vendor/magento/framework/View/Layout.php:557]
#35 MagentoFrameworkViewLayout->renderNonCachedElement() called at [vendor/magento/framework/View/Layout.php:510]
#36 MagentoFrameworkViewLayout->renderElement() called at [vendor/magento/framework/View/Layout.php:975]
#37 MagentoFrameworkViewLayout->getOutput() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#38 MagentoFrameworkViewLayoutInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#39 MagentoFrameworkViewLayoutInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#40 MagentoFrameworkViewLayoutInterceptor->___callPlugins() called at [generated/code/Magento/Framework/View/Layout/Interceptor.php:41]
#41 MagentoFrameworkViewLayoutInterceptor->getOutput() called at [vendor/magento/framework/View/Result/Page.php:260]
#42 MagentoFrameworkViewResultPage->render() called at [vendor/magento/framework/View/Result/Layout.php:171]
#43 MagentoFrameworkViewResultLayout->renderResult() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#44 MagentoFrameworkViewResultPageInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#45 MagentoFrameworkViewResultPageInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#46 MagentoFrameworkViewResultPageInterceptor->___callPlugins() called at [generated/code/Magento/Framework/View/Result/Page/Interceptor.php:32]
#47 MagentoFrameworkViewResultPageInterceptor->renderResult() called at [vendor/magento/framework/App/Http.php:120]
#48 MagentoFrameworkAppHttp->launch() called at [vendor/magento/framework/Interception/Interceptor.php:58]
#49 MagentoFrameworkAppHttpInterceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138]
#50 MagentoFrameworkAppHttpInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/module-application-performance-monitor/Plugin/ApplicationPerformanceMonitor.php:38]
#51 MagentoApplicationPerformanceMonitorPluginApplicationPerformanceMonitor->aroundLaunch() called at [vendor/magento/framework/Interception/Interceptor.php:135]
#52 MagentoFrameworkAppHttpInterceptor->MagentoFrameworkInterception{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153]
#53 MagentoFrameworkAppHttpInterceptor->___callPlugins() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:23]
#54 MagentoFrameworkAppHttpInterceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:264]
#55 MagentoFrameworkAppBootstrap->run() called at [pub/index.php:30]

i have run all commands
bin/magento s:up; bin/magento s:d:c; bin/magento s:s:d -f; bin/magento c:f
cammands are excuting properly

2

Answers


  1. It appears to be a bug in magento.

    In particular, MagentoCustomerViewModelCustomerAuth class is missing from a block parameter declaration in default.xml in your theme. However, the error is thrown due to the classname being called instead of FQN in vendor/magento/module-customer/view/frontend/templates/js/customer-data.phtml on line 14

    $auth = $block->getAuth() ?? ObjectManager::getInstance()->get(Auth::class);
    

    The solution is to add the missing parameter to the block with name "customer.customer.data" making it as following:

    <block name="customer.customer.data"  class="MagentoCustomerBlockCustomerData"
                   template="Magento_Customer::js/customer-data.phtml">
                <arguments>
                    <argument name="auth" xsi:type="object">MagentoCustomerViewModelCustomerAuth</argument>
                    <argument name="json_serializer" xsi:type="object">MagentoCustomerViewModelCustomerJsonSerializer</argument>
                    <argument name="cookie_settings" xsi:type="object">MagentoCustomerViewModelCookieSettings</argument>
                </arguments>
            </block>
    
    Login or Signup to reply.
  2. how to override above inside custom theme or custom module

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search