2

I am working on Magento2.3.2 in the AWS server with Lightsail Instance with the website URL https://13.235.236.199/.

Suddenly the website is not opening and it is showing the error sometimes like

Could not load Sales Channels for Stock

I thought one of the installed extension is causing the error. So, I disabled that extension and ran the following commands:

php bin/magento setup:upgrade
php bin/magento indexer:reindex
php bin/magento cache:clean

Still no improvement.

Sometimes, I am getting the error instead of the above error,

Something happening while loading the website. Please check exception log for details

The error in exception.log is as follows:

[2020-01-02 09:36:42] main.CRITICAL: Class Magento\Framework\App\Http\Interceptor does not exist {"exception":"[object] (ReflectionException(code: -1): Class Magento\Framework\App\Http\Interceptor does not exist at /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Code/Reader/ClassReader.php:19)"} []

New Update:

As per the existed answers, I recompiled the code, deployed the static content and cleared the cache.

Now, I got a new issue like the following:

Warning: file_put_contents(/opt/bitnami/apps/magento/htdocs/var/cache//mage-tags/mage---6da_COMPILED_CONFIG): failed to open stream: Permission denied in /opt/bitnami/apps/magento/htdocs/vendor/colinmollenhour/cache-backend-file/File.php on line 691

After successful working the website, again get new error in log:

{"0":"Warning: file_put_contents(/opt/bitnami/apps/magento/htdocs/var/cache//mage-tags/mage---c40_MAGE): failed to open stream: Permission denied in /opt/bitnami/apps/magento/htdocs/vendor/colinmollenhour/cache-backend-file/File.php on line 691","1":"#1 file_put_contents('/opt/bitnami/app...', 'c40_THEME_BY_ID_...', 10) called at [vendor/colinmollenhour/cache-backend-file/File.php:691]\n#2 Cm_Cache_Backend_File->_updateIdsTags(array('c40_THEME_BY_ID_...'), array('c40_MAGE'), 'merge') called at [vendor/colinmollenhour/cache-backend-file/File.php:203]\n#3 Cm_Cache_Backend_File->save('{\"theme_id\":\"4\",...', 'c40_THEME_BY_ID_...', array('c40_MAGE'), NULL) called at [vendor/magento/zendframework1/library/Zend/Cache/Core.php:390]\n#4 Zend_Cache_Core->save('{\"theme_id\":\"4\",...', 'c40_THEME_BY_ID_...', array('c40_MAGE'), NULL, 8) called at [vendor/magento/framework/Cache/Core.php:74]\n#5 Magento\Framework\Cache\Core->save('{\"theme_id\":\"4\",...', 'THEME-BY-ID-4', array('c40_MAGE'), NULL) called at [vendor/magento/framework/Cache/Frontend/Adapter/Zend.php:63]\n#6 Magento\Framework\Cache\Frontend\Adapter\Zend->save('{\"theme_id\":\"4\",...', 'theme-by-id-4', array('MAGE'), NULL) called at [vendor/magento/framework/Cache/Frontend/Decorator/Bare.php:75]\n#7 Magento\Framework\Cache\Frontend\Decorator\Bare->save('{\"theme_id\":\"4\",...', 'theme-by-id-4', array('MAGE'), NULL) called at [vendor/magento/framework/Cache/Frontend/Decorator/TagScope.php:52]\n#8 Magento\Framework\Cache\Frontend\Decorator\TagScope->save('{\"theme_id\":\"4\",...', 'theme-by-id-4', array('MAGE'), NULL) called at [vendor/magento/framework/Cache/Frontend/Decorator/Bare.php:75]\n#9 Magento\Framework\Cache\Frontend\Decorator\Bare->save('{\"theme_id\":\"4\",...', 'theme-by-id-4', array(), NULL) called at [vendor/magento/framework/App/Cache.php:73]\n#10 Magento\Framework\App\Cache->save('{\"theme_id\":\"4\",...', 'theme-by-id-4', array(), NULL) called at [vendor/magento/framework/App/Cache/Proxy.php:81]\n#11 Magento\Framework\App\Cache\Proxy->save('{\"theme_id\":\"4\",...', 'theme-by-id-4') called at [vendor/magento/module-theme/Model/Theme/ThemeProvider.php:166]\n#12 Magento\Theme\Model\Theme\ThemeProvider->saveThemeToCache(&Magento\Theme\Model\Theme#0000000002ffcfb7000000003cdd0d2d#, 'theme-by-id-4') called at [vendor/magento/module-theme/Model/Theme/ThemeProvider.php:132]\n#13 Magento\Theme\Model\Theme\ThemeProvider->getThemeById(4) called at [vendor/magento/framework/View/Design/Theme/FlyweightFactory.php:102]\n#14 Magento\Framework\View\Design\Theme\FlyweightFactory->_loadById(4) called at [vendor/magento/framework/View/Design/Theme/FlyweightFactory.php:64]\n#15 Magento\Framework\View\Design\Theme\FlyweightFactory->create(4, 'frontend') called at [vendor/magento/module-theme/Model/View/Design.php:148]\n#16 Magento\Theme\Model\View\Design->setDesignTheme(4) called at [vendor/magento/module-theme/Model/View/Design.php:212]\n#17 Magento\Theme\Model\View\Design->setDefaultDesignTheme() called at [vendor/magento/framework/App/Area.php:261]\n#18 Magento\Framework\App\Area->_initDesign() called at [vendor/magento/framework/App/Area.php:219]\n#19 Magento\Framework\App\Area->_loadPart('design') called at [vendor/magento/framework/App/Area.php:143]\n#20 Magento\Framework\App\Area->load('design') called at [vendor/magento/framework/View/DesignLoader.php:54]\n#21 Magento\Framework\View\DesignLoader->load() called at [vendor/magento/framework/App/Action/Plugin/Design.php:48]\n#22 Magento\Framework\App\Action\Plugin\Design->beforeDispatch(&Magento\Cms\Controller\Index\Index\Interceptor#0000000002ffcfd3000000003cdd0d2d#, &Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#) called at [vendor/magento/framework/Interception/Interceptor.php:121]\n#23 Magento\Cms\Controller\Index\Index\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#) called at [vendor/magento/framework/Interception/Interceptor.php:153]\n#24 Magento\Cms\Controller\Index\Index\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#), array(array('designLoader', 'customerNotifica...', 'catalog_app_acti...', 'tax-app-action-d...', 'weee-app-action-...', 'storeCheck', 'contextPlugin', 'customer-app-act...'))) called at [generated/code/Magento/Cms/Controller/Index/Index/Interceptor.php:26]\n#25 Magento\Cms\Controller\Index\Index\Interceptor->dispatch(&Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#) called at [vendor/magento/framework/App/FrontController.php:159]\n#26 Magento\Framework\App\FrontController->processRequest(&Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#, &Magento\Cms\Controller\Index\Index\Interceptor#0000000002ffcfd3000000003cdd0d2d#) called at [vendor/magento/framework/App/FrontController.php:99]\n#27 Magento\Framework\App\FrontController->dispatch(&Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#) called at [vendor/magento/framework/Interception/Interceptor.php:58]\n#28 Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', array(&Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#)) called at [vendor/magento/framework/Interception/Interceptor.php:138]\n#29 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#) called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:94]\n#30 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#0000000002ffcd18000000003cdd0d2d#, &Closure#0000000002ffccf5000000003cdd0d2d#, &Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#) called at [vendor/magento/framework/Interception/Interceptor.php:135]\n#31 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#) called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:69]\n#32 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(&Magento\Framework\App\FrontController\Interceptor#0000000002ffcd18000000003cdd0d2d#, &Closure#0000000002ffccf5000000003cdd0d2d#, &Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#) called at [vendor/magento/framework/Interception/Interceptor.php:135]\n#33 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(&Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#) called at [vendor/magento/framework/Interception/Interceptor.php:153]\n#34 Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', array(&Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#), NULL) called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26]\n#35 Magento\Framework\App\FrontController\Interceptor->dispatch(&Magento\Framework\App\Request\Http#0000000002ffca53000000003cdd0d2d#) called at [vendor/magento/framework/App/Http.php:137]\n#36 Magento\Framework\App\Http->launch() called at [vendor/magento/framework/App/Bootstrap.php:261]\n#37 Magento\Framework\App\Bootstrap->run(&Magento\Framework\App\Http\Interceptor#0000000002ffcaad000000003cdd0d2d#) called at [index.php:39]\n</pre>","url":"/","script_name":"/index.php"}

  • I will look the question shortly – Amit Bera Jan 2 at 8:28
  • remove generated and check again – Murtuza Zabuawala Jan 2 at 9:14
  • @TejaBhagavanKollepara please disable webkul module and try again, i think issue because of webkul module – Murtuza Zabuawala Jan 2 at 9:24
  • @MurtuzaZabuawala, i have disabled all existing 7 webkul modules and ran the setup:upgrade, indexer and cache commands also. still no change, its loading only – Teja Bhagavan Kollepara Jan 2 at 11:47
  • try to give open permission to var/ pub/ generated/ – Partab Saifuddin Zakir Jan 2 at 14:42
5
+50

Things you can try:

remove the generated code directory (again):

rm generated/code -rf

upgrade your modules and re-compile:

php bin/magento setup:upgrade
php bin/magento setup:di:compile

if there are any errors during compile, you found the reason for your problem - fix these errors first, and redo all the steps mentioned here.

and if you're in production mode (check the output of php bin/magento deploy:mode:show)

php bin/magento setup:static-content:deploy 

and finally clean your cache:

php bin/magento cache:clean

Update regarding the second warning/error:

You need to get your file permissions right, the magento Documentation is a good place to read up on the topic: https://devdocs.magento.com/guides/v2.3/config-guide/prod/prod_file-sys-perms.html

To summarize, this is what you need to do (assuming you have a user, let's say mage and a group, let's say www-data on your system)

Fix the file ownership:

cd /opt/bitnami/apps/magento/htdocs/
chown -R mage:www-data *

Fix the file permissions:

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 {} +

And maybe try manually deleting your cache directory:

rm -rf var/cache

If this doesn't help, please post the output of ls -al in your magento root directory (which is /opt/bitnami/apps/magento/htdocs/).

|improve this answer|||||
6

Magento2 Class Magento\Framework\App\Http\Interceptor does not exist

This issue is generate when you have make changes in your construction file and it's Factory class is not update in generated folder

For that you need remove generated folder from your magento root

rm -rf generated/*

After remove generated now compile the site

php bin/magento setup:di:compile

After successful compilation now deploy the content

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

now check your issue is resolved... Please accept answer if it's resolved.

|improve this answer|||||
1

After 3-4 days of searching for the issue on the internet, I found the answer as the follows:

Add the following configuration to your app/etc/env.php file right before the last line of ];

  'cache' =>
  array (
    'frontend' =>
    array (
      'default' =>
      array (
        'backend_options' =>
        array (
          'hashed_directory_umask' => NULL,
          'directory_mode' => NULL,
          'file_mode' => NULL,
        ),
      ),
    ),
  ),

Afterwards, be sure to have the correct permissions and SETGID bit assigned to the var and var/page_cache and var/cache directories, as described in the devdocs. You can set to drwxrwsr-x. Next, run the following commands as your magento file-system user:

php bin/magento setup:upgrade
php bin/magento indexer:reindex
php bin/magento cache:clean

Source: https://github.com/magento/magento2/issues/10588

|improve this answer|||||
0

Interceptor does not exist issue arises when changing made in constructor parameters and the Factory classes is not generated anyhow.

For that you need remove generated folder from your magento root

rm -rf generated/*

After remove generated run following commands

php bin/magento setup:upgrade

after upgrading databases and created dynamic classes in generated folder run

php bin/magento setup:di:compile

After successful compilation now deploy the content

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

In developer and default mode static content deploy not neede for that you have to deploy static content forcefully -f

now check issue has been resolved. Please accept answer if it's resolved.

|improve this answer|||||

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.