Search code examples
recaptcharecaptcha-v3

Recaptcha v3 Issue - performance.now is not a funtion


I've just started implementing Google Recaptcha v3, exactly as in the documentation.

<script src='https://www.google.com/recaptcha/api.js?render=MY_API_KEY'></script>
<script>
    grecaptcha.ready(function() {
        grecaptcha.execute('MY_API_KEY', {action: 'homepage'})
            .then(function(token) {

            });
    });
</script>

But I keep getting this error;

Uncaught TypeError: performance.now is not a function

The error is being thrown in https://www.gstatic.com/recaptcha/api2/v1541614764654/recaptcha__en.js which is called in https://www.google.com/recaptcha/api.js

Unfortunately there doesn't seem to be any answers with the same scenario.


Solution

  • I found the answer.

    performance.now was added into the api.js file and in another of my scripts, there was a variable named performance being used. I changed the name of this variable which sorted the issue.

    Maybe that can help someone else!