0

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.

  • I think you should ask Taxjar to check it. – Phoenix128_RiccardoT May 20 '17 at 18:02
  • @Phoenix128_RiccardoT but it occurs for a personal module that I wrote as well. I've completely removed TaxJar, just deployed my extension and it does the same thing. Remove my extension and the error goes away. What could be the issue with Mage::getSingleton('admin/session');? – sparecycle May 20 '17 at 18:04
  • If you could share the line content raising the error I could try to figure out. – Phoenix128_RiccardoT May 20 '17 at 18:05
  • Shared for both modules @Phoenix128_RiccardoT. – sparecycle May 20 '17 at 18:19
  • Mmm... weird. Are you sure you correctly flush cache and no module is trying to override admin/session ? – Phoenix128_RiccardoT May 20 '17 at 18:21
0

The session issue could be related to how your servers were configured. It's best to discuss this with your hosting provider or sysadmin support provider. The fix could be, cache and sessions need to be connected to redis on admin server.

0

The error is indicating that the call to Mage::getSingleton is returning something other than an object. I would first check to see if the result of Mage::getSingleton('admin/session') returns an instance of Mage_Admin_Model_Session. My guess is that there is something like code compilation enabled that you aren't aware of it accounting for.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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