I encountered the following issue when I have moved Magento 2 module into production with the command setup:di: compile
Uncaught Error: Call to a member function setActive() on boolean in /opt/bitnami/apps/magento/htdocs/vendor/magento/module-backend/Model/View/Result/Page.php:27\nStack trace: /opt/bitnami/apps/magento/htdocs/generated/code/Magento/Backend/Model/View/Result/Page/Interceptor.php(24): Magento\Backend\Model\View\Result\Page->setActiveMenu('...')
I found a solution to delete magento\generated\metadata\global.php
file which worked.
Does anyone know the purpose of global.php
file and is it safe to delete it?
Thanks in advance.
di:compile
. You'll want to find a root cause of your issue, rather than trying to delete core Magento files.