Closed nikolazic closed 5 years ago
Hi @nikolazic
Thanks for raising this issue. I'm going to investigate it and will release a extension update if required. I'm assuming this is a edge case and not causing you massive issues. I'm aiming to investigate this early next week.
Hi @nikolazic
I've not been able to reproduce this. I'm running the latest ShipperHQ code on Magento 2.2.4. I only have ShipperHQ installed.
I've tried shipping to both US and non US addresses with a 256 character street line 1 and I see the error message that I'd expect to see.
Please let me know if you have any further information on this issue.
@wsajosh ,
We are running 2.2.3. We will try reproducing this again with the latest module and 2.2.3 and let you know what we find.
@wsajosh We were able to reproduce the bug on a clean magento 2.2.3 installation. Please see detailed steps to reproduce below:
composer require shipperhq/module-shipper
php bin/magento module:enable --all
php bin/magento setup:upgrade --keep-generated
php bin/magento cache:clean
@wsajosh Proposed solution is here - https://github.com/shipperhq/module-shipper/pull/54
@vkalchenko Thanks! I can see the error now. I've tested it with your proposed fix and it does stop the server error but I'm seeing the error message show up twice. I don't think we need to add to the message queue in the catch as its been added already. Are you seeing the same error message twice in your tests?
@wsajosh Yes, I've also seen the duplicate error. You're right, no need to add this message to the message queue, adding just try...catch should be enough. See updated pull request - https://github.com/shipperhq/module-shipper/pull/55
@vkalchenko Thanks! Looks good. I've got our lead development reviewing this so it can be merged in
This has been implemented in our module and will be in the next release. Thanks all involved for the detailed steps and fix
Steps to replicate
Actual A 503 error
Expected The form should reload with an error message:
The issue is in the ShipperHQ_Shipper module observer:
ShipperHQ\Shipper\Observer\CustomerAddressEdit
Line 80:
This save throw an exception if address has more than 256 characters. This is normally caught in the controller and the error is saved in the session. However, this observer is in post-dispatch and it does not catch this error, it let's it bubble up and cause a 503.
Line 80 should be in a try/catch and an exception should caught, logged, or the observer should not fire if there are issues found to begin with (consider either inspecting the message storage or observing
session_abstract_add_message
. See \Magento\Framework\Message\Manager::addMessage)