31

Exception.log file Error:

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

asked Jul 19, 2019 at 7:04
2
  • 2
    Same, I just installed magento fresh from composer and are facing problems already... they need to improve their documentation. Commented Nov 29, 2019 at 9:51
  • Good day I have the following problem, try the permission commands to the folders and nothing Class "Magento\Framework\App\Request\BackpressureValidator" does not exist Exception #0 (ReflectionException): Class "Magento\Framework\App\Request\BackpressureValidator" does not exist <pre>#1 Magento\Framework\Code\Reader\ClassReader->getConstructor() called at [vendor/magento/framework/ObjectManager/Definition/Runtime.php:54] #2 Magento\Framework\ObjectManager\Definition\Runtime->getParameters() called at [vendor/magento/framework/ObjectManager/Factory/Compiled.php:100] #3 Magento\Framework\ObjectM Commented May 30, 2023 at 14:16

7 Answers 7

68

The Interceptor file is deleted. Need to recreate Interceptor

Run di:compile command

php bin/magento setup:di:compile
answered Jul 19, 2019 at 7:10
0
19

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/
answered Jul 19, 2019 at 7:07
5
  • 4
    @WaqarAli, why chmod 777 ??? This is insecure Commented 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 Commented Nov 29, 2019 at 10:15
  • 3
    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. Commented Mar 30, 2021 at 20:25
  • that works for me thanks Commented 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. Commented Jul 19, 2021 at 17:50
11

Run commands:

 chmod -R 777 var
 chmod -R 777 pub/static
 chmod -R 777 generated
answered Jun 3, 2020 at 8:08
8

SOLVED.

chmod -R 777 var/* generated/* pub/static/
answered Jun 28, 2021 at 13:17
3

[Run di:compile command]

php bin/magento setup:di:compile

[and flush the cache]

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

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.

answered Mar 25, 2021 at 12:14
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
) {
answered May 13, 2021 at 14:15

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.