22

Exception.log file Error:

{"exception":"[object] (ReflectionException(code: -1): Class Magento\Framework\App\Http\Interceptor does not exist

1
  • Same, I just installed magento fresh from composer and are facing problems already... they need to improve their documentation.
    – Black
    Nov 29, 2019 at 9:51

7 Answers 7

56

The Interceptor file is deleted. Need to recreate Interceptor

Run di:compile command

php bin/magento setup:di:compile
0
15

This occurs Because you can inject Magento\Framework\App\Http in any our class

try following steps

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:Deploy -f

chmod -R 777 var/ generated/
5
  • 3
    @WaqarAli, why chmod 777 ??? This is insecure
    – Black
    Nov 29, 2019 at 9:54
  • 1
    you need full permission on server because magento delete and create new files in var, pub, and gernated folder when setup:upgrade command runs
    – Waqar Ali
    Nov 29, 2019 at 10:15
  • 2
    it would be better to use find var/ -type d -exec chmod 775 {} + && find var/ -type f -exec chmod 665 {} +(repeated for the generated dir also) that way you set the executable bit on the directories, and the read write permission for the user and group on the files, without wholesale blanketing everything with executable bits. Mar 30, 2021 at 20:25
  • that works for me thanks
    – Sebastian
    Apr 15, 2021 at 2:43
  • I was only facing this issue on my dev environment (docker). this solution worked for me well enough for my dev environment, but I would not include the chmod -R 777 ... on a production server if it could be at all avoided. Jul 19, 2021 at 17:50
5

Run commands:

 chmod -R 777 var
 chmod -R 777 pub/static
 chmod -R 777 generated
2

SOLVED.

chmod -R 777 var/* generated/* pub/static/
0

An interceptor may also be missing if its parent class' constructor fails for some reason.

An example of this is when you override a class, but your override's constructor fails due to a bad class reference in the constructor arguments or for some other reason.

0

[Run di:compile command]

php bin/magento setup:di:compile

[and flush the cache]

php bin/magento cache:flush
1
  • 1
    however you should never run setup:di:compile when in developer mode May 27, 2021 at 10:51
0

For me the problem was that I missed the backslash when defining construct function arguments:

public function __construct(
    Magento\Framework\App\Action\Context $context
) {

was instead of

public function __construct(
    \Magento\Framework\App\Action\Context $context
) {

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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