Magento2 Module Error – Fix Error After Version Upgrade

databaseerrormagento2moduleupgrade

I was recently trying to upgrade our Magento from 2.2.5 to Magento 2.2.7. I thought I succeeded but we're currently getting the following error:

There has been an error processing your request Exception printing is
disabled by default for security reasons.

Error log record number: 335576744754

Having looked at this var log I can see the following message:

{"0":"Please update your modules: Run \"composer install\" from the
Magento root directory.\nThe following modules are
outdated:\nAmazon_Core db schema version: defined in codebase – 2.1.2,
currently installed – 2.2.7\nAmazon_Core db data version: defined in
codebase – 2.1.2, currently installed – 2.2.7\nAmazon_Login db schema
version: defined in codebase – 2.1.1, currently installed –
2.2.7\nAmazon_Login db data version: defined in codebase – 2.1.1, currently installed – 2.2.7\nAmazon_Payment db schema version: defined
in codebase – 2.1.1, currently installed – 2.2.7\nAmazon_Payment db
data version: defined in codebase – 2.1.1, currently installed –
2.2.7\nKlarna_Core db schema version: defined in codebase – 4.5.2, currently installed – 4.5.6\nKlarna_Core db data version: defined in
codebase – 4.5.2, currently installed – 4.5.6\nKlarna_Ordermanagement
db schema version: defined in codebase – 4.4.1, currently installed –
4.4.2\nKlarna_Ordermanagement db data version: defined in codebase – 4.4.1, currently installed – 4.4.2\nKlarna_Kp db schema version: defined in codebase – 5.5.1, currently installed – 5.5.4\nKlarna_Kp db
data version: defined in codebase – 5.5.1, currently installed –
5.5.4","1":"#0 /var/www/vhosts/mysite.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(121):
Magento\Framework\Module\Plugin\DbStatusValidator->beforeDispatch(Object(Magento\Framework\App\FrontController\Interceptor),
Object(Magento\Framework\App\Request\Http))\n#1
/var/www/vhosts/mysite.com/httpdocs/app/code/Infortis/Cgen/Plugin/Magento/Framework/App/FrontController.php(32):
Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#2
/var/www/vhosts/mysite.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(135):
Infortis\Cgen\Plugin\Magento\Framework\App\FrontController->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor),
Object(Closure), Object(Magento\Framework\App\Request\Http))\n#3
/var/www/vhosts/mysite.com/httpdocs/vendor/magento/framework/Interception/Interceptor.php(153):
Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))\n#4
/var/www/vhosts/mysite.com/httpdocs/generated/code/Magento/Framework/App/FrontController/Interceptor.php(26):
Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch',
Array, Array)\n#5
/var/www/vhosts/mysite.com/httpdocs/vendor/magento/framework/App/Http.php(135):
Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#6
/var/www/vhosts/mysite.com/httpdocs/generated/code/Magento/Framework/App/Http/Interceptor.php(24):
Magento\Framework\App\Http->launch()\n#7
/var/www/vhosts/mysite.com/httpdocs/vendor/magento/framework/App/Bootstrap.php(257):
Magento\Framework\App\Http\Interceptor->launch()\n#8
/var/www/vhosts/mysite.com/httpdocs/index.php(39):
Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))\n#9
{main}","url":"/admin_adminname/","script_name":"/index.php"}

I've logged into SSH and tried to run "Composer install" but it says there is nothing to update.

I've tried numerous other commands including:

 php bin/magento setup:upgrade
 bin/magento cache:clean
 php -f bin/magento setup:static-content:deploy

Having looked in the "setup_module" table I can see that the versions in the table do not correspond with the versions in module manager as evidenced in the screenshot below

Screenshot

I could really use some advice if anyone knows how to resolve this

Best Answer

An easy solution to this, although it may not be conventional is to go to your websites database and find the setup_module table.

Find the modules that are causing the problems in the module column and change the schema_version and data_version columns appropriately.

Hope this helps.

You could also try having a look at your json.lock file, and changing the versions to what they should be and then deleting these modules and running composer install

Related Topic