Amphtml: amp-recaptcha-input: reCAPTCHA.execute() error on form submit

Created on 5 Sep 2019  Â·  6Comments  Â·  Source: ampproject/amphtml

The reCAPTCHA AMP script is experiencing the following error on submit:

log.js:232 There was an error running execute() on the reCAPTCHA script.
log.js:232 Form submission failed: Error: There was an error running execute() on the reCAPTCHA script. at V.push.f.V.M (https://cdn.ampproject.org/v0/amp-recaptcha-input-0.1.js:42:55) at c (https://cdn.ampproject.org/v0/amp-recaptcha-input-0.1.js:41:334) at c (https://cdn.ampproject.org/v0/amp-recaptcha-input-0.1.js:36:185) at b (https://cdn.ampproject.org/v0/amp-recaptcha-input-0.1.js:35:445)

Exemple:
https://amp.dev/documentation/examples/components/amp-recaptcha-input/

image

amp-recaptcha-input Bug components

Most helpful comment

Hello, I solved the problem by only enabling the "Allow this key to work with AMP pages" option in the admin console and allowing actions with a prefix 'amp_'.
Note: In my case it was not necessary to register an alternate URL with the suffix 'recaptcha.ampproject.net'.

All 6 comments

Is there any new on this? As for now it renders the https://amp.dev/documentation/examples/components/amp-recaptcha-input component unusable...

Hello. Is there any news on this? I have implemented an AMP page where the user must pass reCaptcha to actually move on to the next pages after a form submission and I get this error as well. If this isn't solved I can't use the AMP page cause users won't be able to pass it. I'm blocked by this. 

Hi, I don’t think there will be a solution any time soon. At the moment
your only choice is to use a server side only user input validation (based
on ip address for example) or to implement your own captcha solution using
an image (amp-img) and session.
Somebody would have to dig in the source of this component to find and fix
the problem, but it takes too much time.

Jozsef

Georgia-CarFlexi notifications@github.com (időpont: 2019. okt. 30., Sze,
7:35) ezt írta:

Hello. Is there any news on this? I have implemented an AMP page where the
user must pass reCaptcha to actually move on to the next pages after a form
submission and I get this error as well. If this isn't solved I can't use
the AMP page cause users won't be able to pass it. I'm blocked by this.

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/ampproject/amphtml/issues/24372?email_source=notifications&email_token=AMV7WJESR64ANHPEJGSKPI3QRETJDA5CNFSM4IT6EB6KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECTCA2Y#issuecomment-547758187,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AMV7WJE3VNTINBAAEL7IHHDQRETJDANCNFSM4IT6EB6A
.

Jozsef thank you for you response but I think I found a solution for this bug.

If you check your AMP page there is an iframe[data-amp-3p-sentinel="amp-recaptcha"] added.
This iframe has a specific url (https://www-yourdomain-com.recaptcha.ampproject.net/....)
You have to add this specific subdomain (www-yourdomain-com.recaptcha.ampproject.net)
to your supported domains for your site key on reCaptcha admin console.

This needs to be documented better!

After you implement this you might find that the response 'action' label you're getting from reCaptcha validation is adding a prefix to your given 'action' label ('amp_' + yourAction). It creates a missmatch (given != returned). This is happening only to AMP pages for all others, given==returned, so keep an eye for this.

This should also be added to the documentation

This worked for me. I hope it helps others..

Jozsef thank you for you response but I think I found a solution for this bug.

If you check your AMP page there is an iframe[data-amp-3p-sentinel="amp-recaptcha"] added.
This iframe has a specific url (https://www-yourdomain-com.recaptcha.ampproject.net/....)
You have to add this specific subdomain (www-yourdomain-com.recaptcha.ampproject.net)
to your supported domains for your site key on reCaptcha admin console.

This needs to be documented better!

After you implement this you might find that the response 'action' label you're getting from reCaptcha validation is adding a prefix to your given 'action' label ('amp_' + yourAction). It creates a missmatch (given != returned). This is happening only to AMP pages for all others, given==returned, so keep an eye for this.

This should also be added to the documentation

This worked for me. I hope it helps others..

Hi, I'm having the same problem with recaptcha on AMP, but I didn't find iframe [data-amp-3p-sentinel = "amp-recaptcha"] on my page.

Hello, I solved the problem by only enabling the "Allow this key to work with AMP pages" option in the admin console and allowing actions with a prefix 'amp_'.
Note: In my case it was not necessary to register an alternate URL with the suffix 'recaptcha.ampproject.net'.

Was this page helpful?
0 / 5 - 0 ratings