-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Checkout rules.js:56 Uncaught TypeError: Cannot read property 'length' of undefined #4921
Comments
I'm getting the same error. |
Same error here. |
Error appears on Magento 2.0.7, Magento 2.1-RC2 |
This is the error from min_text_length and max_text_length. The problem is somehow value is returned as null. So I add null-check logic before accessing its property.
|
I also faced the same issue, but it is not happening always |
Hi Magento team, Is the fix going to be included into Magento 2.1 stable release? It is blocking logged in customers to place an order. cc: @antonkril Thanks, |
Do you have any updates regarding this issue? Thanks, |
Does anybody have a fix for this please? |
any alternative way to fix it? i cant finish developing my gateway because of this |
It happens in Magento 2.1.0 as well. I am facing the same issue. |
The problem can be better describe like this:1: When you directly go to checkout page: http://example.com/checkout. Checkout page loads and no error. My debugI debugged that something happens behind in Local storage of browser in both of the above described scenario. Upon checking on case 1: My Local storage stores mage-cache-storage with value(beautified Json format) like below: Upon checking on case 2: My Local storage stores mage-cache-storage with value(beautified Json format) like below: |
Solutionjust in case if store configuration for customer address is 2 or more street lines then rules.js gives the error. Change store configuration in: |
We create internal ticket to solve this issue MAGETWO-47240 |
@sky4git thanks!!! your solution works well! You saved me a lot of headache |
Where is this store configuration? Can't find in 2.1 ee backend. |
@rashidio You can find store configuration: STORES->Settings->All Stores |
Number of Lines in a Street Address changed to 1 works for me! Thanks! |
2.1.0 GA, can reproduce. Can reproduce. Happens if I create a standard shipping address inside the logged in user's profile. You must be logged in for this to reproduce (in 2.1.0). Very urgent to fix! This stops the user from checking out . How to reproduce
How to workaroundLike earlier described here, you can set number of lines in street address to 1. How the checkout looks |
Hi @piotrekkaminski @pboisvert Kindly ask you to update us because it is really blocker for everyone. Thank you in advance, |
Fix for this issue was delivered to the develop branch with the commit 7fb8a9c. |
Thank god I got the solution at the right time. |
@sanjayjethva @magento-team If we make the street address configuration to 1 then the customer will not be able to login if he already have 2 line in street address because it looks like the system validatation is happening during login and I am getting the below exception.
|
@ferrazzzz I apologize. I believe I commented on the wrong issue. |
issue still available in 2.1.2 and will be fixed with changing address lines to 1 ! |
I couldn't set the address lines to 1 because it is multi-line attribute and its minimum value is 2.
In this case the require-entry is set on the first line of the street and required-entry is set to false on the second line of the street. |
Seeing this issue too in 2.1.2. Just tested @liiskmaa's suggestion, and it works 👍 |
@piotrekkaminski when is 2.1.3 due? This is stopping me developing a payment module |
I'm able to reprocedure this on Magento 2.1.0 EE, I can't find configuration like @sky4git solution. So I have to move to @liiskmaa solution. I think at this moment, that is the only way to fix this issue in Magento 2.1.x EE Magento\Checkout\Block\Checkout\AttributeMergerChange
to
|
Clearing local storage worked for me. |
What is the status of a fix for this issue? This is a critical error preventing people from checking out. I'm disappointed that this issue has been known for so long and a proper Magento fix is yet to be released. I need a better solution than changing the number of lines in the street to 1, this is not an acceptable solution as many of our users have addresses with multiple lines. I need and update on this as soon as possible. |
Here's a solution which builds on that provided by @liiskmaa, but doesn't require modification to the core code. Create a new plugin in a custom module. I've named it AttributeMerger.
Then define the plugin in your di.xml.
|
seems to be fixed in CE 2.1.3 |
@sma09sjb, are you running CE 2.1.3? I just tested it, and it seems fixed in 2.1.3 |
@erfanimani i'm running CE 2.1.2, I will try an upgrade. |
@erfanimani just upgraded but still have the same error:
|
Not sure how relevant this is, but might be a line of enquiry to track down the issue for Magento . While changing the street address lines to 1 in the config fixed the issue for submitting the form, for existing customers with 2 address lines this made them not visible in their account and the backend. Through some testing I've found that if you enter exactly the same text in line 2 as you do in line 1 the form will submit successfully, it looks as though the validation is looking to compare the 2 fields rather than validate them individually? If someone else experiencing these issues can also test and confirm if this is the case then perhaps Magento developers can look into this. |
@sky4git you're a life saver! |
Just an update, this now happening on 2.1.8 Sky4git's solution still works: |
This is even worse. There is no explanation what so ever when you want to add customers by code. I clearly give just 1 line
And my whole ssh console is full with
When i go and take a look at the setstreet function :
This provides no information at all. It expect an array but what kind of array? How would you define your array? Do i need to assume that i do not need to provide keys like 'street1' ? magento 2.1.8 Edit This has been fixed by just replacing all extra spaces with a single space like this (i know its a messy code , i will make a function out of that.) . I will leave this here for future reference. Maybe just always delete extra spaces on setStreet? Unless there is a reason to not add that. Still not sure why getStreet needs the array when appearently 2 spaces or \n moves everything to the second line. |
@veloraven By default, this issue is caused by one of the API request on the cart page. To do a workaround, copy and edit this file in your theme: In function
Flush cache, deploy static content and when you visit checkout page make sure in browser that address-converter.js has your changes. Since local storage is already set and if the issue is still not fixed, you can delete 'browser cache' (local storage included) and try to reproduce the bug again. It should not show again. It doesn't work if you increase or decrease the street number of lines without this fix. Also make sure you have same number in Admin > Stores > Configuration > Customer > Customer Configuration > Name and Address Options > Number of Lines in Street Address |
Not so appealing but this trick solved the issue :- |
The problem still exist if you turn on js bundling (EE ver. 2.2.5). Does anyone have solution which works with turned on js bundling? |
MQE-1836: Bump MFTF version in Magento
Almost 4 years after the initial report of this bug and its still here... |
@operator888
Where
The value of street address is corrupted.
Magento devs did an workaround for this. Apparently it's not working all the time. |
This is still a problem on Magento 2.4.2 If you check out as a guest then it works but as soon as you log in and checkout you get the validation error. I have used the solution that @komsitr suggested and implemented it for both min and max fields as you will get the min error after you fix the max error. You can find this in the vendor\magenot\module-ui\view\base\web\lib\validation\rules.js and edit lines line 63 (Min Rule) and line 69 (Max Rule) Change to : return !value || (!!value && value.length <= +params); Worked for me! |
Do not use this solution! it looked like it worked at first but it creates new issues. |
Having this issue on two magento installations ver. 2.0.4 and ver. 2.0.6. (the second one is a new installation without any modules, blank theme)
Steps to reproduce
Expected result
Checkout page with pre-filled information
Actual result
Javascript error blocking rendering of the page
rules.js:56 Uncaught TypeError: Cannot read property 'length' of undefined
The text was updated successfully, but these errors were encountered: