postnl/postnl-magento1-End-of-life

Call to undefined method TIG_PostNL_Model_Resource_Setup::installTestApikey()

Closed this issue · 10 comments

Make sure you are using the latest version: https://tig.nl/postnl-magento-extensies/

Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running the latest version of the TIG PostNL Magento extension.

What is the purpose of your issue?

  • Bug report (encountered problems with the TIG PostNL Magento extension)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

Description of your issue, suggested solution and other information

When updating from 1.12.4 to either 1.15.0 or 1.15.1, the webshop will display a 500 error and the logs show:

2018/03/13 18:04:02 [error] 19069#0: *322553 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught Error: Call to undefined method TIG_PostNL_Model_Resource_Setup::installTestApikey() in /home/secret/domains/secret.tld/public_html/app/code/community/TIG/PostNL/sql/postnl_setup/upgrade-1.12.4-1.13.0.php:59
Stack trace:
#0 /home/secret/domains/secret.tld/public_html/includes/src/TIG_PostNL_Model_Resource_Setup.php(394): include()
#1 /home/secret/domains/secret.tld/public_html/includes/src/Mage_Core_Model_Resource_Setup.php(437): TIG_PostNL_Model_Resource_Setup->_modifyResourceDb('upgrade', '1.12.4', '1.15.0')
#2 /home/secret/domains/secret.tld/public_html/includes/src/Mage_Core_Model_Resource_Setup.php(320): Mage_Core_Model_Resource_Setup->_upgradeResourceDb('1.12.4', '1.15.0')
#3 /home/secret/domains/secret.tld/public_html/includes/src/TIG_PostNL_Model_Resource_Setup.php(244): Mage_Core_Model_Resource_Setup->applyUpdates()
#4 /home/secret/domains/secret.tld/public_html/includ" while reading response header from upstream, client: 77.170.114.153, server: secret.tld, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php-fpm/php-fpm-secret.sock:", host: "secret.tld"

Magento version: 1.9.3.6 (fully patched).
Cache disabled/cleared.
PHP version: 7.0.27

Good morning Sebastiaan,

Sorry for my delayed reaction.

Just tried to reproduce this problem, but when i follow those steps no problems appear on a default Magento environment. Could you provide more information about this? How did you update, just by uploading the new files?

Kind regards,

Jasper
TIG

Likewise apologies for the delayed response.
The exact command I used to upgrade the PostNL plugin was:

modman update postnl-magento1 --force --copy

The command itself finishes without any errors, however, when loading the website aforementioned error is thrown.

Annoyingly the website we're working with does not have a development environment so I cannot freely troubleshoot, as anything we change happens on the production environment.
The only other 2 plugins we have installed are Adyen and Adyen subscriptions.

Hi Sebastiaan,

Could you try running it without the --force command when updating and see if you get an error? We always recommend running it on a test environment first, but i understand that this is not possible.

Could you let me know the outcome of running it without that command?

Kind regards,

Jasper
TIG

Hello Jasper,

Unfortunately, that makes no difference, same message. The reason we used --force was because we accidentally installed it without --copy earlier, causing modman to symlink it instead. This is no longer supported in Magento.
--force forcefully overwrites old files, including symlinks.

Hi Sebastiaan,

Could you try running n98-magerun sys:setup:run manually?
And can you confirm that this exact line of code is present in app/code/community/TIG/PostNL/Model/Resource/Setup.php :

/** * Saves the default test apikey in the database as an encrypted string. * * @return $this */ public function installTestApikey() { $testApikey = self::DEFAULT_TEST_APIKEY; /** @var Mage_Core_Helper_Data $helper */ $helper = Mage::helper('core'); $encryptedApikey = $helper->encrypt($testApikey); /** @var Mage_Core_Model_Config_Data $config */ $config = Mage::getModel('core/config_data') ->load(self::XPATH_TEST_APIKEY, 'path'); $config->setValue($encryptedApikey) ->setPath(self::XPATH_TEST_APIKEY) ->save(); return $this; }

If running the command doesn't work, the code is not present in that file AND you are running this on a staging environment then you could try removing the ->installTestApiKey() from the setup file and try again.

Hopefully this helps, if not please let me know.

Kind regards,

Jasper
TIG

Hello Jasper,

Sorry for yet another slow response, I finally decided to set up a proper staging environment...

n98-magerun sys:setup:run worked like a charm. Took a second, threw done as output and the website worked again.
Strange how that works, but automatic updating doesn't for me.

Do you want to keep this issue open to find out why this edge case fails or do we go with PEBCAK and close it?

Update: Okay, more stuff seems to be broken after all.
When I click the PostNL settings in the backend I get another 500 error, logs say the following:

PHP message: PHP Fatal error:  Uncaught Error: Call to undefined method TIG_PostNL_Model_Core_System_Config_Source_EuProductOptions::getAvailableAvondOptions() in /home/secret/domains/secret.tld/public_html/includes/src/TIG_PostNL_Block_Adminhtml_System_Config_Form.php:512

Any idea what could cause this?

Hi Sebastiaan,

Can you send me a message on sd@tig.nl and provide me with login information for the staging backend and SSH access? We can take a look at this if you want. This will be the fastest option.

Kind regards,

Jasper
TIG

Finally figured it out.
I'd have sworn it was disabled but apparently compilation was enabled, this was the source of all our problems.
So yeah, PEBCAK after all. Thanks for your time in helping me look for a solution.

Hi Sebastiaan,

Good to hear that you found the solution!

Kind regards,

Jasper
TIG