Exception: Area code not set: Area code must be set before starting a session.
Opened this issue · 12 comments
In production environment there is an error logged in exception log continuosly
[2018-01-05 08:19:16] main.CRITICAL: Area code not set: Area code must be set before starting a session. {"exception":"[object] (Magento\Framework\Exception\SessionException(code: 0): Area code not set: Area code must be set before starting a session. at [website_path]/vendor/magento/framework/Session/SessionManager.php:175, Magento\Framework\Exception\LocalizedException(code: 0): Area code is not set at [website_path]/vendor/magento/framework/App/State.php:152)"} []
Preconditions
- Magento 2.2.2
- Ubuntu 16.04 Server
- PHP 7.0.22
- Mysql 5.7.19
- Magento installed/deployed with composer
- Magento in production mode
After some search i found that with this module disabled the problem is disappeared.
How can i help you to identify the problem? If there is one...
Hello @samuelecarpene ,
we were unable to reproduce this issue, can you provide additional information?
We saw the same issue. I wasn't able to identify the pattern exactly, but it seemed to happen after a deploy. I'm not sure if it's the recompliation, static deploy or cache flush that would trigger it. After a few page loads it would seem to go away.
I think I know where problem is. Your plugin is applied too deep on Zend Response guts where Magento area code is not set yet at least in production mode.
Same issue. Disabled this module and my store works now.
Yes, the issue is confirmed on 2.2, we are working on that
the same issue with the extension when enabling maintenance mode.
So sorry for making you wait for so long time. We had crazy time :)
Thanks to @maqlec , this issue should be fixed.
Does this issue have been solved? We also need it.
Thanks!
I had the same issue today: When the maintenance mode is enabled (in either Production Mode or Developer Mode) this error pops up, hiding the actual message that is given by the maintenance mode itself.
However, I don't think this necessarily needs a fix: In the Developer Mode, you don't need a maintenance mode - perhaps the docs of DevTools could just give a hint that the maintenance mode doesn't work well with the DevTools extension. And in the Production Mode, you should not use the DevTools extension anyway! The extension should be added to the require-dev
section, not the require
section.
We also experience this issue on our development sites, we run 2.3.1.
The issue occurs every time we perform a setup:upgrade or a cache clean.
It also prevents us from accessing the admin side of our site.
After you set bin/magento maintenance:enable
in both development or production, this error is thrown.
Any update on a fix for this :)