The Beginnings:
This is the article for Magento 2 Advent Calendar 2018 25th day of 2019.
In this article, I am going to describe some of my experience in upgrading magento2.3.0 to 2.3.3 and its consequences errors and important steps to take care off before starting up.
Execution Enviroment
Magento 2.3.0
PHP 7.1.23
MySQL 5.7.24 Apache 2.4.29
Steps to reproduces:
- Back up the magento2.3 database
- Back up composer.json file from root in the Magento installation directory.
- use command: composer require magento/product-community-edition=2.3.3 --no-update
- composer update
consequent errors might occurs:
Unfortunately using above command is not to be and we would stuck into something like the following:
1.
if this type of error occurs, then we need to remove all the third party extensions from composer.json and try once again.
- "The following exception is caused by a lack of memory or swap, or not having swap configured Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details" solution: use this command: php -d memory_limit=2G /usr/local/bin/composer update
If all goes well we will see the upgrade process happening:
Any errors at this stage are likely caused by the extensions that need to be upgraded at the same time as Magento to stay compatible.
Now that we have the latest code the only thing left to do is make sure that the database itself is also upgraded with.
Use this command:
bin/magento setup:upgrade
And then we can confirm in the admin that we have upgraded to 2.3.3.
After successful upgrade to 2.3.3 you may also face other consequent errors.
- Catalog pagination issue on Elasticsearch
- Email Message Interface backward compatibility error
- Uncaught TypeError: urldecode() expects parameter 1 to be string, boolean given in (in CommunityEngineering/JapaneseUrlRewrite)
- Warning: Declaration of CommunityEngineering\JapaneseName\Model\DataObject\Copy::setAttributeValueFromExtensibleDataObject($target,$code,$value)...
- Insufficient inventory error when shipping items
- When creating a cancellation / credit memo, it will get an error that the product cannot be returned
- Even if the available quantity is 0, the product will still be displayed on the product list page.
Solution for those errors:
Catalog_pagination_issue_on_Elasticsearch_6_composer-2019-10-11-08-07-41.patch this is security patches which needs to be applied
command: in shell use patch -p1 < Catalog_pagination_issue_on_Elasticsearch_6_composer-2019-10-11-08-07-41.patchEmailMessageInterface_2.3.3_backward_compatibility_composer-2019-10-30-10-20-09.patch this is another patches needs to be inserted
command: in shell use patch -p1 < EmailMessageInterface_2.3.3_backward_compatibility_composer-2019-10-30-10-20-09.patchCommunityEngineering/JapaneseUrlRewrite needs to be disabled
php bin/magento module:disable:CommunityEngineering_JapaneseUrlRewrite-
add some lines in CommunityEngineering/JapaneseName/Model/DataObject/Copy.php
first confirm the order data only using : php bin/magento inventory:reservation:list-inconsistencies
then use this command:
bin/magento inventory:reservation:list-inconsistencies -r | bin/magento inventory:reservation:create-compensationsuse this command to solve above one : insert into inventory_shipment_source(shipment_id, source_code) values({ShipmentId}, {return stock source_name})
use this sql:
SELECT
e.entity_id,
csi.is_in_stock,
isi.quantity + SUM(ir.quantity) as salable_quantity
FROM
catalog_product_entity AS e
LEFT JOIN inventory_source_item isi ON e.sku=isi.sku
LEFT JOIN inventory_reservation ir ON e.sku = ir.sku
LEFT JOIN cataloginventory_stock_item as csi on e.entity_id=csi.product_id
GROUP BY e.sku
HAVING salable_quantity=0 and is_in_stock=1;
and check if salable_quantity=0 then change the status to out_of_stock.
In short
There are lot more problems occurred in upgrading 2.3.3 and most of them are likely solved during upgrading process. I was stucked into those problems and tried to find out the solution for those errors. And finally able to solve those problem just googling and consulting to friends.
So, before upgrading to 2.3.3 we need to take care lot of steps and the above steps may help to someone else who tries to do the same as I had done before.