4

After adding custom module on Server. It's giving below error

 Fatal error: Uncaught Error: Call to a member function getId() on null
 in
 /var/www/html/magento/vendor/magento/module-backend/Block/Menu.php:296
 Stack trace: #0
 /var/www/html/magento/vendor/magento/framework/View/Element/AbstractBlock.php(975):
 Magento\Backend\Block\Menu->getCacheKeyInfo() #1
 /var/www/html/magento/vendor/magento/framework/View/Element/AbstractBlock.php(1027):
 Magento\Framework\View\Element\AbstractBlock->getCacheKey() #2
 /var/www/html/magento/vendor/magento/framework/View/Element/AbstractBlock.php(652):
 Magento\Framework\View\Element\AbstractBlock->_loadCache() #3
 /var/www/html/magento/vendor/magento/framework/View/Layout.php(542):
 Magento\Framework\View\Element\AbstractBlock->toHtml() #4
 /var/www/html/magento/vendor/magento/framework/View/Layout.php(518):
 Magento\Framework\View\Layout->_renderBlock('menu') #5
 /var/www/html/magento/var/generation/Magento/Framework/View/Layout/Interceptor.php(206):
 Magento\Framework\View\Layout->renderNonCachedElement('menu') #6
 /var/www/html/magento/vendor/magento/framewo in
 /var/www/html/magento/vendor/magento/module-backend/Block/Menu.php on
 line 296

It's displaying when Session Timeout from Admin

2
  • Did you find any solution?
    – Raül
    Commented Jul 24, 2018 at 9:29
  • @Ankit Shah Did you find out what caused it? Same issue here. Commented Mar 28, 2019 at 16:17

1 Answer 1

0

I was able to get around this issue by linking to an "interstitial" URL first (a controller) which simply redirected to the view URL.

The controller will kick the user back to the login page if the session is expired. If it's not expired, it will redirect to the view.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.