klaviyo / magento2-klaviyo

37 stars 51 forks source link

Area code is already set #166

Open aibean opened 2 years ago

aibean commented 2 years ago

klaviyo/magento2-extension 4.0.1

When running the following command:

bin/magento queue:consumer:start product_action_attribute.update

I get,

In State.php line 136:
Area code is already set  

If I trace the error I get the following output:

#0  Magento\Framework\App\State->setAreaCode(adminhtml) called at [/var/www/html/vendor/klaviyo/magento2-extension/Helper/ScopeSetting.php:72]
#0  Magento\Framework\App\State->setAreaCode(global) called at [/var/www/html/vendor/magento/module-message-queue/Console/StartConsumerCommand.php:91]
mamsincl commented 11 months ago

+1 with 4.0.11


edit: the culprit found in custom code injecting Klaviyo\Reclaim\Helper\Logger into __construct where the area code set in construct workflow - my specific resolution is to use Klaviyo\Reclaim\Helper\Logger\Proxy to overcome the issue


This is still Magento coding standard issue as area code have never been set in the constructor workflow