HamzaHannad / Magento2-SlackLogger

5 stars 2 forks source link

Cache frontend 'default' is not recognized. As well as defaultcache is not configured #2

Open vasilii-b opened 2 months ago

vasilii-b commented 2 months ago

Right after installing the extension via composer and running bin/magento s:up getting this error. Made sure it's not project-related - the issue occurs only when installing this extension.

Having a look at the code of the extension, I don't see a direct change of the Cache Pool and/or adding new cache types, but for some reason it has an impact. Perhaps the changes from \Magify\SlackNotifier\Model\Config\Backend\Encrypted affects it.

image

There is an error in /var/www/html/vendor/magento/framework/App/Cache/Frontend/Pool.php at line: 162
Cache frontend 'default' is not recognized. As well as defaultcache is not configured#0 /var/www/html/vendor/magento/framework/App/Cache/Type/FrontendPool.php(87): Magento\Framework\App\Cache\Frontend\Pool->get('default')
#1 /var/www/html/vendor/magento/framework/App/Cache/Type/Config.php(52): Magento\Framework\App\Cache\Type\FrontendPool->get('config')
#2 /var/www/html/vendor/magento/framework/Cache/Frontend/Decorator/Bare.php(65): Magento\Framework\App\Cache\Type\Config->_getFrontend()
#3 /var/www/html/vendor/magento/framework/Interception/PluginList/PluginList.php(227): Magento\Framework\Cache\Frontend\Decorator\Bare->load('global|primary|...')
#4 /var/www/html/vendor/magento/framework/Interception/PluginList/PluginList.php(190): Magento\Framework\Interception\PluginList\PluginList->_loadScopedData()
#5 /var/www/html/generated/code/Magento/Framework/Logger/Monolog/Interceptor.php(58): Magento\Framework\Interception\PluginList\PluginList->getNext('Magento\\Framewo...', 'setHandlers')
#6 /var/www/html/vendor/monolog/monolog/src/Monolog/Logger.php(194): Magento\Framework\Logger\Monolog\Interceptor->setHandlers(Array)
#7 /var/www/html/vendor/magento/framework/Logger/Monolog.php(32): Monolog\Logger->__construct('main', Array, Array, NULL)
#8 /var/www/html/generated/code/Magento/Framework/Logger/Monolog/Interceptor.php(14): Magento\Framework\Logger\Monolog->__construct('main', Array, Array, NULL)
#9 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(121): Magento\Framework\Logger\Monolog\Interceptor->__construct('main', Array, Array, NULL)
#10 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#11 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\CloudCo...')
#12 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(170): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\CloudCo...')
#13 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(276): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Psr\\Log\\LoggerI...', NULL, 'logger', 'Magento\\CloudCo...')
#14 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(239): Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument('Magento\\CloudCo...', Array, Array)
#15 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\\CloudCo...', Array, Array)
#16 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\CloudCo...', Array, Array)
#17 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\CloudCo...')
#18 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(170): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\CloudCo...')
#19 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(276): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Framewo...', NULL, 'logger', 'Magento\\Framewo...')
#20 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(239): Magento\Framework\ObjectManager\Factory\AbstractFactory->getResolvedArgument('Magento\\Framewo...', Array, Array)
#21 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(34): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgumentsInRuntime('Magento\\Framewo...', Array, Array)
#22 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(59): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->_resolveArguments('Magento\\Framewo...', Array, Array)
#23 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(56): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...', Array)
#24 /var/www/html/vendor/magento/framework/App/Cache/Frontend/Factory.php(216): Magento\Framework\ObjectManager\ObjectManager->create('Magento\\Framewo...', Array)
#25 /var/www/html/vendor/magento/framework/App/Cache/Frontend/Factory.php(180): Magento\Framework\App\Cache\Frontend\Factory->_applyDecorators(Object(Magento\Framework\Cache\Frontend\Decorator\TagScope))
#26 /var/www/html/vendor/magento/framework/App/Cache/Frontend/Pool.php(69): Magento\Framework\App\Cache\Frontend\Factory->create(Array)
#27 /var/www/html/vendor/magento/framework/App/Cache/Frontend/Pool.php(156): Magento\Framework\App\Cache\Frontend\Pool->_initialize()
#28 /var/www/html/vendor/magento/framework/App/Cache.php(38): Magento\Framework\App\Cache\Frontend\Pool->get('default')
#29 /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(121): Magento\Framework\App\Cache->__construct(Object(Magento\Framework\App\Cache\Frontend\Pool), NULL)
#30 /var/www/html/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php(66): Magento\Framework\ObjectManager\Factory\AbstractFactory->createObject('Magento\\Framewo...', Array)
#31 /var/www/html/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Framewo...')
#32 /var/www/html/vendor/magento/framework/App/Cache/Proxy.php(44): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Framewo...')
#33 /var/www/html/vendor/magento/framework/App/Cache/Proxy.php(67): Magento\Framework\App\Cache\Proxy->_getCache()
#34 /var/www/html/vendor/magento/framework/App/ProductMetadata.php(78): Magento\Framework\App\Cache\Proxy->load('mage-version')
#35 /var/www/html/vendor/magento/framework/Console/Cli.php(99): Magento\Framework\App\ProductMetadata->getVersion()
#36 /var/www/html/bin/magento(22): Magento\Framework\Console\Cli->__construct('Magento CLI')
#37 {main}

Preconditions: Adobe Commerce 2.4.6-p6

HamzaHannad commented 2 months ago

Hello @vasilii-b ,

Thank you for bringing this to our attention.

I tried to reproduce the issue by setting up a fresh Adobe Commerce 2.4.6-p6 environment and installing the extension via Composer. However, I was unable to replicate the error you encountered. The setup completed successfully without any cache-related errors.

The issue you're facing seems to be related to the cache configuration in your specific environment. The error message indicates that the cache frontend 'default' is not recognized, which could be due to a misconfiguration in your env.php file or a missing cache configuration.

Could you please check your env.php file to ensure that all necessary cache types are correctly configured? Also, make sure to clear the cache and run bin/magento cache:clean and bin/magento cache:flush to see if that resolves the issue.

If the problem persists, it might help to provide more details about your setup, including any custom cache configurations or third-party modules that might be affecting the cache pool.

Looking forward to your response.

Best regards, Hamza

vasilii-b commented 2 months ago

Hey @HamzaHannad , I did re-test here.

2 different Magento Open Source projects - worked ✅ 2 different Adobe Commerce projects - same issue as reported ⛔

vasilii-b commented 2 months ago

Update

Was able to replicate the issue on a custom module when trying to add a plugin for the monolog\logger.

When have this commented out - all works fine.

<type name="Monolog\Logger">
        <plugin name="magify_slack_notifier_logger" type="Magify\SlackNotifier\Plugin\Logger" />
    </type>
HamzaHannad commented 2 months ago

Hi @vasilii-b,

Thank you for the update and for retesting on different projects.

I appreciate the detailed feedback. Unfortunately, I currently don't have access to an Adobe Commerce environment to replicate the issue. However, based on your findings, it seems like the problem may be related to the custom plugin configuration for Monolog\Logger.

If there's anything else you want me to investigate or if you have more details on the error messages or logs from Adobe Commerce, please share them, and I'll do my best to help!

Best, Hamza

vasilii-b commented 2 months ago

That's correct @HamzaHannad . Looks like the plugin for Monolog logger causes the issue. My understanding so far is that at the time the change is requested, the cache pool tries to get the default cache configuration, but it cannot - most likely because it's not available somehow.

I'll try to investigate it.

HamzaHannad commented 2 months ago

Hi @vasilii-b

I appreciate you looking into this further. If you discover any more specific details or need any additional assistance, feel free to reach out. I'm here to help however I can!