0

Basically fresh install of Magento 2.2.5. Whenever I switch to developer mode, my site completely breaks with:

ReflectionException: Class Magento\Framework\App\Http\Interceptor does not exist in /home/200582.cloudwaysapps.com/dyxjcgvyzs/public_html/vendor/magento/framework/Code/Reader/ClassReader.php:19 Stack trace: #0 /home/200582.cloudwaysapps.com/dyxjcgvyzs/public_html/vendor/magento/framework/Code/Reader/ClassReader.php(19): ReflectionClass->__construct('Magento\\Framewo...') #1 /home/200582.cloudwaysapps.com/dyxjcgvyzs/public_html/vendor/magento/framework/ObjectManager/Definition/Runtime.php(44): Magento\Framework\Code\Reader\ClassReader->getConstructor('Magento\\Framewo...') #2 /home/200582.cloudwaysapps.com/dyxjcgvyzs/public_html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(48): Magento\Framework\ObjectManager\Definition\Runtime->getParameters('Magento\\Framewo...') #3 /home/200582.cloudwaysapps.com/dyxjcgvyzs/public_html/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array) #4 /home/200582.cloudwaysapps.com/dyxjcgvyzs/public_html/vendor/magento/framework/App/Bootstrap.php(232): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Framewo...', Array) #5 /home/200582.cloudwaysapps.com/dyxjcgvyzs/public_html/pub/index.php(36): Magento\Framework\App\Bootstrap->createApplication('Magento\\Framewo...') #6 {main}

After this, I do all kinds of things like resetting permissions, clearing cache, switching back and forth from production to developer, rm -rf var/cache/* var/page_cache/* var/generation/* and find var generated pub/static pub/media app/etc -type f -exec chmod g+w {} \; && find var generated pub/static pub/media app/etc -type d -exec chmod g+ws {} \;, restarting services, and so on. I cannot find a pattern or cause for what is going on. Sometimes I clear the cache, and it comes back. Sometimes I reset permissions, and it works. But sometimes not. But switching to developer mode always breaks it.

2

1 Answer 1

1

Turns out this had to do with missing classes that was caused by me running this recommended Magento optimization:

composer dump-autoload -o --apcu

To revert this, I first tried deleting the vendor/composer directory completely, doing composer update, and magento setup:upgrade. This might help others, but I am not 100% sure b/c I then ran into unrelated redirect issues - but I no longer received the ReflectionException error.

When I restored to a backup before doing the dump-autoload, this fixed my Magento 2 install, and I checked the vendor/composer directory to be sure the autoloader files there were the ones installed by default.

Your Answer

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

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