I'm trying to implement recaptcha v3 on a form that's hosted by Flywheel (Wordpress) and running into an 'Uncaught (in promise) null' when trying to store the captcha token using the javascript provided by google:
<script src="https://www.google.com/recaptcha/api.js?render=reCAPTCHA_site_key"></script>
<script>
grecaptcha.ready(function() {
grecaptcha.execute('reCAPTCHA_site_key', {action: 'homepage'}).then(function(token) {
$('#captcha_key').val(token);
});
});
</script>
I defined the hidden inputs to store the captcha key values:
<input type="hidden" id="captcha_key" name="captcha_key" />
The javascript sees my function(token) and the Promise looks ok:

When I provide this same script in our own hosted webapp (Java Spring), everything executes without issue and the captcha_key is correctly stored for verification. Does anyone have any ideas as to what could be causing this issue in Wordpress? I've tracked it down to the .then(function(token)) execution that triggers the error, just not sure why the above code would work on one environment but not another even though the logic is essentially the same.