cancel
Showing results for 
Search instead for 
Did you mean: 

Java Script Error in Chrome in Magento 2.4 (Uncaught TypeError in email.js line 165)

Java Script Error in Chrome in Magento 2.4 (Uncaught TypeError in email.js line 165)

Hi 

The magento is throwing below javascript error  and thats stop checkout page to load forever on checkout 

Step to products 

1. Add item to cart 

2. Proceed to Checkout 

3. Add email address and try to login 

The spinning wheen is running forever  and only get the page back on refresh, getting below error in chrome 

Uncaught TypeError: Cannot read property 'check' of undefined

    at UiClass.validateEmail (email.js:165)

    at UiClass.emailHasChanged (email.js:90)

    at setNested (objects.js:43)

    at Object.nested (objects.js:117)

    at UiClass.set (element.js:305)

    at updateValue (links.js:80)

    at Function.notifySubscribers (knockout.js:1320)

    at Function.valueHasMutated (knockout.js:1538)

    at UiClass.observable [as email] (knockout.js:1504)

    at setNested (objects.js:43)

 

 

5 REPLIES 5

Re: Java Script Error in Chrome in Magento 2.4 (Uncaught TypeError in email.js line 165)

HI There,

 

same issue seen in 2.4.1

 

Uncaught TypeError: Cannot read property 'check' of undefined
at UiClass.validateEmail (email.js:165)

 

is there any known issue and if so, any solution for this?

 

THanks in advance

Re: Java Script Error in Chrome in Magento 2.4 (Uncaught TypeError in email.js line 165)

open your browser console and check 

jQuery("form[data-role=email-with-possible-login]").length

this should result in 1 

 

or if this return 0 then you need to check your theme and 3rd party module 

it may be possible that the email.html has been overridden in theme or 3rd party module 

you need to check that and update the form with the same data-role same as defined 

<form class="form form-login" data-role="email-with-possible-login"
      data-bind="submit:login"
      method="post">

 

kindly Accept as Solution if this works for you and give Kudos Smiley Happy 

Re: Java Script Error in Chrome in Magento 2.4 (Uncaught TypeError in email.js line 165)

HI amitsamsukha,

 

as i'm a bi newbie to magento, one thing i can confirm:

jQuery("form[data-role=email-with-possible-login]").length

is resulting in 0.

As i'm doing the stuff in developer mode, could'nt find any third-party module which is explicitly replacing html.

Howver i know ther is one module which is initiating before this error (local DHL module). This one is however not using an HTM ltemplate but .js files.

 

Any hint what to looking for?

Best regards

Re: Java Script Error in Chrome in Magento 2.4 (Uncaught TypeError in email.js line 165)

I have the same issue, exactly the same steps as described above. Does anyone have any ideas? I've searched everywhere and can't find an answer. Thanks

Re: Java Script Error in Chrome in Magento 2.4 (Uncaught TypeError in email.js line 165)

Hi amitsamsukha,

 

Same issue in magento 2.4.2.
When a logged-in customer go "Proceed to Checkout" with a saved cart and "Pick in Store" method is available,
emailHasChanged function in
Magento_Checkout/js/view/form/element/email.js:85 will be triggered by Magento_InventoryInStorePickupFrontend/js/view/form/element/email.js.

 

As per your suggestion, it should be expected that the form "form[data-role=email-with-possible-login]" is not required for a logged-in customer.

 

The error will not occur after the customer refresh the checkout page but will reoccur when the customer login and repeat the above mentioned actions again...

 

Please let us know if you have any other suggestion to resolve the issue?