m2-MSP_DevTools icon indicating copy to clipboard operation
m2-MSP_DevTools copied to clipboard

Exception: Area code not set: Area code must be set before starting a session.

Open samuelecarpene opened this issue 7 years ago • 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

  1. Magento 2.2.2
  2. Ubuntu 16.04 Server
  3. PHP 7.0.22
  4. Mysql 5.7.19
  5. Magento installed/deployed with composer
  6. 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...

samuelecarpene avatar Jan 12 '18 13:01 samuelecarpene

Hello @samuelecarpene , we were unable to reproduce this issue, can you provide additional information?

phoenix128 avatar Jan 23 '18 13:01 phoenix128

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.

scottsb avatar Jan 24 '18 16:01 scottsb

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.

maqlec avatar Mar 09 '18 14:03 maqlec

Same issue. Disabled this module and my store works now.

jefflenz avatar May 13 '18 18:05 jefflenz

Yes, the issue is confirmed on 2.2, we are working on that

phoenix128 avatar May 13 '18 18:05 phoenix128

the same issue with the extension when enabling maintenance mode.

magefan avatar May 15 '18 08:05 magefan

So sorry for making you wait for so long time. We had crazy time :) Thanks to @maqlec , this issue should be fixed.

phoenix128 avatar May 18 '18 15:05 phoenix128

Does this issue have been solved? We also need it. Thanks!

cavalier79 avatar Aug 06 '18 12:08 cavalier79

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.

jissereitsma avatar Feb 07 '19 22:02 jissereitsma

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.

jonasGossiaux avatar Jun 11 '19 08:06 jonasGossiaux

After you set bin/magento maintenance:enable in both development or production, this error is thrown.

VernonGrant avatar Jul 19 '19 06:07 VernonGrant

Any update on a fix for this :)

stephen-larkbury avatar Aug 08 '24 15:08 stephen-larkbury