0

I have this kind of error in logs that I have difficulties to understand. I found some infos on "Area code is not set" errors in CLI, but not on the frontend side. Have you suggestions ?

{"0":"Area code is not set","1":"#0 /data/www/.../.../vendor/magento/module-customer/Model/Plugin/CustomerNotification.php(78): Magento\Framework\App\State->getAreaCode()\n#1 /data/www/.../.../vendor/magento/framework/Interception/Interceptor.php(121): Magento\Customer\Model\Plugin\CustomerNotification->beforeDispatch(Object(Magento\Customer\Controller\Section\Load\Interceptor), Object(Magento\Framework\App\Request\Http))\n#2 /data/www/.../.../vendor/magento/framework/Interception/Interceptor.php(153): Magento\Customer\Controller\Section\Load\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#3 /data/www/.../.../generated/code/Magento/Customer/Controller/Section/Load/Interceptor.php(26): Magento\Customer\Controller\Section\Load\Interceptor->___callPlugins('dispatch', Array, Array)\n#4 /data/www/.../.../vendor/magento/framework/App/FrontController.php(55): Magento\Customer\Controller\Section\Load\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#5 /data/www/.../.../vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))\n#6 /data/www/.../.../vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)\n#7 /data/www/.../.../vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#8 /data/www/.../.../vendor/magento/framework/Interception/Interceptor.php(135): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))\n#9 /data/www/.../.../vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(73): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#10 /data/www/.../.../vendor/magento/framework/Interception/Interceptor.php(58): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))\n#11 /data/www/.../.../vendor/magento/framework/Interception/Interceptor.php(138): Magento\PageCache\Model\App\FrontController\BuiltinPlugin\Interceptor->___callParent('aroundDispatch', Array)\n#12 /data/www/.../.../vendor/magento/framework/Interception/Interceptor.php(153): Magento\PageCache\Model\App\FrontController\BuiltinPlugin\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))\n#13 /data/www/.../.../generated/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin/Interceptor.php(26): Magento\PageCache\Model\App\FrontController\BuiltinPlugin\Interceptor->___callPlugins('aroundDispatch', Array, Array)\n#14 /data/www/.../.../vendor/magento/framework/Interception/Interceptor.php(135): Magento\PageCache\Model\App\FrontController\BuiltinPlugin\Interceptor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))\n#15 /data/www/.../.../vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#16 /data/www/.../.../generated/code/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)\n#17 /data/www/.../.../vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#18 /data/www/.../.../generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()\n#19 /data/www/.../.../vendor/magento/framework/App/Bootstrap.php(257): Magento\Framework\App\Http\Interceptor->launch()\n#20 /data/www/.../.../index.php(40): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))\n#21 {main}","url":"/customer/section/load/?sections=cart&update_section_id=false&_=1547830571669","script_name":"/index.php"}

1
  • Have you installed any third party extension? Commented Jan 20, 2019 at 8:56

1 Answer 1

1

The reason is your modules have action process data in upgrade/install module.

Firstly: Find your modules process that script.

After that, add a area code to file update/install:

private $state;

public function __construct(\Magento\Framework\App\State $state) {
    $this->state = $state;
    parent::__construct();
}

public function execute() {
    $this->state->setAreaCode(\Magento\Framework\App\Area::AREA_FRONTEND); // or \Magento\Framework\App\Area::AREA_ADMINHTML, depending on your needs
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.