Closed IlliaGoldin closed 2 years ago
Hi @IlliaGoldin
We've had a report like this before and based on my earlier research, can I ask you to try to run bin/magento catalog:images:resize
and see if this give you the same error or not? if you don't get an error, you can cancel this process after some seconds by pressing the ctrl+c combination on your keyboard.
The reason I'm asking to run this command is because it uses similar code as in this module here where we try to set the areaCode while executing this module.
If it doesn't give you an error, I'll try it as well over here on Magento 2.2.1 first and see if I can reproduce this.
If it does give you an error, that means that the bug is most likely located in a different place. If I have to guess, you'll probably have a 3rd party module, or some custom code that tries to call setAreaCode
in one of the constructors of the php classes in those modules or custom code (which is really bad). In that case try to find this and temporarily comment out that line and then try to use this module again, it should start working. Then figure out a solution for that other code to see how that can properly be handled.
Thanks!
Hi @hostep
I have run bin/magento catalog:images:resize
and it resulted in the same error "Area code is already set"
I also found the module responsible for this. Will be looking into how to handle this.
Thank you very much!
Problem solved.
Magento Version: 2.2.1
Reproduce Run any of the CLI commands provided in the README.md of the module.
Result Screenshot
Output in text format `application@f38ef7308717:/app$ bin/magento catalog:category:integrity:urlpath An unexpected exception occured: 'Area code is already set'
0 /app/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\App\State->setAreaCode('crontab')
1 /app/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\App\State\Interceptor->___callParent('setAreaCode', Array)
2 /app/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\App\State\Interceptor->Magento\Framework\Interception{closure}('crontab')
3 /app/generated/code/Magento/Framework/App/State/Interceptor.php(52): Magento\Framework\App\State\Interceptor->___callPlugins('setAreaCode', Array, Array)
4 /app/app/code/Baldwin/UrlDataIntegrityChecker/Console/Command/CheckCategoryUrlPaths.php(57): Magento\Framework\App\State\Interceptor->setAreaCode('crontab')
5 /app/vendor/symfony/console/Command/Command.php(245): Baldwin\UrlDataIntegrityChecker\Console\Command\CheckCategoryUrlPaths->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
6 /app/vendor/symfony/console/Application.php(835): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
7 /app/vendor/symfony/console/Application.php(185): Symfony\Component\Console\Application->doRunCommand(Object(Baldwin\UrlDataIntegrityChecker\Console\Command\CheckCategoryUrlPaths), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
8 /app/vendor/magento/framework/Console/Cli.php(102): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
9 /app/vendor/symfony/console/Application.php(117): Magento\Framework\Console\Cli->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
10 /app/bin/magento(23): Symfony\Component\Console\Application->run()
11 {main}`
Expected result List of URL path / URL key issues.
Note Admin panel version of the module works.