Skip to main content
3 of 3
added 431 characters in body
sparecycle
  • 1.5k
  • 3
  • 27
  • 51

500 PHP error on Mage:getSingleton('admin/session') after separating admin and frontend servers

Working with Magento CE v1.9.2.3 with Redis

Doing development for a website that makes use of a separate frontend and admin server in their production environment. I'm attempting to deploy TaxJar and a custom module that I've written to the production environment. They both happen to make use of the same Magento PHP resource in code:

Mage::getSingleton('admin/session');

They've been wanting to install TaxJar for a while and were aware of the error but couldn't make sense of it. Now I've created a module that makes use of the same getSingleton resource and they both trigger the same 500 error whenever it's used in the production environment. Here is the error message on TaxJar:

PHP Fatal error: Call to a member function isLoggedIn() on a non-object in /var/app/current/app/code/community/Taxjar/SalesTax/Model/Observer/AdminNotifications.php on line 31

Worth noting this 500 error does not occur in my local environment, development, or staging where the frontend and admin instances are not separated and do not make use of Redis.

Has anyone ever seen an issue similar to this for other modules or extensions? What could be a cause of this error?

Some context around the code that is causing the 500 error in my custom module:

$session = Mage::getSingleton('admin/session');
if (!$session->isLoggedIn() || !$session->getData(self::IS_PASSWORD_EXPIRED)) {
    return;
}

The context for TaxJar:

    if (Mage::getSingleton('admin/session')->isLoggedIn()) {
        $this->checkUpdate();
    }

In both cases it's using a conditional.

sparecycle
  • 1.5k
  • 3
  • 27
  • 51