Magento - 升级到 2.4.3 后无法查看订单

Magento - unable to view order after upgrade to 2.4.3

我最近将 Magento(开源)商店从 2.4.2 升级到了 2.4.3。客户使用 PayPal Express Checkout 作为付款方式下了订单。

当我尝试在管理屏幕中查看他们的订单时,出现错误订单加载期间出现异常

如果我随后检查 exception.log,我会收到以下消息:

main.CRITICAL: Type Error occurred when creating object: Magento\InventorySourceSelection\Model\Address, Argument 1 passed to Magento\InventorySourceSelection\Model\Address::__construct() must be of the type string, null given, called in vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121 {"exception":"[object] (Magento\Framework\Exception\RuntimeException(code: 0): Type Error occurred when creating object: Magento\InventorySourceSelection\Model\Address, Argument 1 passed to Magento\InventorySourceSelection\Model\Address::__construct() must be of the type string, null given, called in vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121 at vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php:131)"} []

我认为这是由 2.4.3 升级引起的,因为在此之前的其他订单都没有问题。大多数订单 升级后也很好,所以这个有点奇怪。我检查过:

这似乎是同一个问题 noted here on GitHub

我也尝试在我的测试盒上升级到 2.4.3-p1 以查看是否有帮助,但无济于事。我已经尝试了 DI 编译、缓存清除、重新索引等常规技巧

有没有人以前遇到过这种情况并且有任何调试技巧?我目前无法处理订单。

从报错信息来看,我猜测是因为这个订单中的客户地址有误或者缺失数据导致的。

请仔细检查地址并确保您拥有所有信息,尤其是邮政编码。

如果数据丢失,您只需更新地址即可。

事实证明这是 Amasty Shipping Table 费率模块(通过 https://github.com/magento/inventory/issues/2362 找到)中的错误。

解决方法是更改​​:

return $this->inventorySourceSelectionAddressFactory->create([
            'country'   => $shippingAddress->getCountryId(),
            'postcode'  => $shippingAddress->getPostcode() ?? '',
            'street'    => implode("\n", $shippingAddress->getStreet()),
            'region'    => $shippingAddress->getRegionCode() ?? '',
            'city'      => $shippingAddress->getCity() ?? ''
        ]);

到....

return $this->inventorySourceSelectionAddressFactory->create([
            'country'   => $shippingAddress->getCountryId() ?? '',
            'postcode'  => $shippingAddress->getPostcode() ?? '',
            'street'    => implode("\n", $shippingAddress->getStreet()),
            'region'    => $shippingAddress->getRegionCode() ?? '',
            'city'      => $shippingAddress->getCity() ?? ''
        ]);

(更改在 getCountryId() 上)