Not sure this is the right question to ask, but I was given this module with the following line:
$areaCode = $this->state->getAreaCode();
Enabling it gives an error when accessing the website (calling the controller):
Magento\Framework\Exception\LocalizedException: Area code is not set in /var/www/html/magento2/vendor/magento/framework/App/State.php:152
Stack trace: #0 /var/www/html/magento2/vendor/[namespace]/[module]/Plugin/Framework/Session/Config.php(53): Magento\Framework\App\State->getAreaCode()
This makes some sense, but since it controls the session, it requests the area code from something on every page. Either this could be from other parts of the module, or Magento 2 itself.
The question is, if it's the module, how do I know where to put
setAreaCode() (as per: 'Area code not set' issue in custom CLI commands in Magento 2)? There is a large number of controllers /
execute() functions, does every single one of them need a specific area code?
Is it possible that this means that
getAreaCode() should not be used, because there might be another module somewhere that doesn't specify the area code?