0

On the checkout page I am getting the error message Uncaught TypeError: Unable to process binding "afterRender: function(){return renderReCaptcha() }". I searched for the renderReCaptcha() function and found it in \vendor\magento\module-re-captcha-frontend-ui\view\frontend\web\template\reCaptcha.html the template looks fine to me though:

<!--
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
 -->

<div data-bind="{
    attr: {
        'id': getReCaptchaId() + '-wrapper'
    },
    'afterRender': renderReCaptcha()
}">
    <div class="g-recaptcha"></div>
    <!-- ko if: (!getIsInvisibleRecaptcha()) -->
    <div class="field">
        <div class="control">
            <input type="checkbox"
                   value=""
                   class="required-captcha checkbox"
                   name="recaptcha-validate-"
                   data-validate="{required:true}"
            />
        </div>
    </div>
    <!-- /ko -->
</div>

afterRender: function(){return renderReCaptcha() }

4
  • have you solved this issue?
    – Msquare
    Oct 25, 2021 at 14:08
  • @Msquare No, they wanted to fix it on version 2.4.3-p1 - well it's still there. See github.com/magento/magento2/issues/33741 for more details. At least it's only an ugly error message but not stopping the store from working... Oct 25, 2021 at 14:29
  • @Msquare - the link you have shared is not working. Can you let me know how can I resolve this issue Jan 19, 2022 at 12:44
  • @NileshDubey please check it
    – Msquare
    Jan 20, 2022 at 5:44

2 Answers 2

3

Try This

app/code/VendorName/ModuleName/view/frontend

requiejs-config.js

var config = {
    config: {
        mixins: {
            'Magento_ReCaptchaFrontendUi/js/reCaptcha' : {
                'VendorName_ModuleName/js/reCaptcha-mixin' : true
            }
        }
    }
};

app/code/VendorName/ModuleName/view/frontend/web/js

reCaptcha-mixin.js

define([
    'uiComponent',
    'jquery',
    'ko',
    'underscore',
    'Magento_ReCaptchaFrontendUi/js/registry',
    'Magento_ReCaptchaFrontendUi/js/reCaptchaScriptLoader',
    'Magento_ReCaptchaFrontendUi/js/nonInlineReCaptchaRenderer'
], function (Component, $, ko, _, registry, reCaptchaLoader, nonInlineReCaptchaRenderer) {
    'use strict';

    return function(Component) {
        return Component.extend({
            initCaptcha: function () {
                if (typeof this.settings === 'undefined') { 
                    return; 
                }
                this._super();
            },
            
            getIsInvisibleRecaptcha: function () {
                if (typeof this.settings === 'undefined') { 
                    return; 
                }
                return this.settings.invisible;
            }
        });   
    }
});
2

This is core Magento bug.

Please see here: https://github.com/magento/magento2/issues/33741 The fix is here: https://github.com/magento/security-package/pull/302/files

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.