8

Starting from the 18th of June, the Recaptcha on our Magento M1 project has stopped working. In recaptcha__en.js script function Array.prototype.filter returns an error this.each is not a function, because this is not an Array, it’s NodeList, and it can’t be filtered like this.

enter image description here

On the project side, we send a request to URL https://www.google.com/recaptcha/api.js, which returns different responses for different countries.

For AU IP (Also checked IE IP) request script src ashttps://www.gstatic.com/recaptcha/releases/FDTCuNjXhn1sV0lk31aK53uB/recaptcha__en.js

And for EU region it uses https://www.gstatic.com/recaptcha/releases/6OAif-f8nYV0qSFmq-D6Qssr/recaptcha__en.js

Please advise how to solve the problem so we could re-enable the Recaptcha. Could you also tell what could cause it from stopping working?

Dan Bonachea
  • 2,408
  • 5
  • 16
  • 31

2 Answers2

12

Same here, the problem started today at the same time in magento 1, solved with this js :

if ('NodeList' in window) {
    if (!NodeList.prototype.each && NodeList.prototype.forEach) {
        NodeList.prototype.each = NodeList.prototype.forEach;
    }
}
M805
  • 121
  • 2
  • Worked like a charm. I just added it right before where I call recaptcha's api.js and problem solved. – Sean S. Jun 21 '21 at 17:21
5

I have the same problem. I solved it by adding these lines of code just before you have the google ready function call. grecaptcha.ready(...

//fix google recaptcha
if ('NodeList' in window) {
    if (!NodeList.prototype.each && NodeList.prototype.forEach) {
        NodeList.prototype.each = NodeList.prototype.forEach;
    }
}

And the error has been removed.

davilocho
  • 51
  • 1