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"}
Best Answer
Things you can try:
remove the generated code directory (again):
upgrade your modules and re-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
)and finally clean your cache:
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 saywww-data
on your system)Fix the file ownership:
Fix the file permissions:
And maybe try manually deleting your cache directory:
If this doesn't help, please post the output of
ls -al
in your magento root directory (which is /opt/bitnami/apps/magento/htdocs/).