NOTE: This is for a form that is embedded in a node as a paragraph. In the Form Settings page the form ID of the Captcha Point is webform_submission_contact_node_10_add_form.
Recaptcha V3 not working on a contact form.
Submitting a form with Captcha V3 always fails and falls back to the secondary validation method. The error message in Recent Log Messages is:
Google reCAPTCHA v3 validation failed: The response parameter is missing.
Interestingly enough the secondary method also tries to submit during the initial posting of the form and if logging is enabled it will indicate that the secondary method was entered without a value. For instance, if the secondary method is Math, it will report:
webform_submission_contact_node_10_add_form post blocked by CAPTCHA module: challenge Math (by module captcha), user answered "", but the solution was "6".
Steps to reproduce
- Add a contact webform to a node as a paragraph.
- Within the Captcha/ReCaptcha configuration pages add a reCaptcha V3 Action.
- In Captcha Form Settings add a Captcha Point for your Webform (form_id).
- Submit the form.
- Captcha Caching is not enabled.
- Turning off Caching for the site in Performance -> Caching makes no difference but this is a Pantheon hosted site and there may be other caching going on that is beyond our control.
| Comment | File | Size | Author |
|---|
Issue fork recaptcha_v3-3274900
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
dench0@awasson
I can't reproduce, but I suppose that my config is diff from your because in my case webform id is
webform_submission_contact_paragraph_1_add_formCan you export paragraph and node configurations with related fields, or at least provide screenshots of the fields configuration?
Comment #3
avpadernoComment #4
paulmckibbenI am having a similar problem with 8.x-1.5, but with a slightly different log message. Downgrading to 8.x-1.4 resolves the problem for me. The recaptcha is on a webform placed on a page as a layout builder block.
What I saw in the logs:
Google reCAPTCHA v3 validation failed: The response parameter is invalid or malformed. Expected hostname did not match. Expected action did not match.
I also set a breakpoint in recaptcha_v3.module, line 208. What I saw there was $user_input['captcha_response'] was an empty string.
Comment #5
avpaderno@paulmckibben May you post the error message you see?
Comment #6
paulmckibbenHi @apaderno, the error message in the Drupal log was:
Google reCAPTCHA v3 validation failed: The response parameter is invalid or malformed. Expected hostname did not match. Expected action did not match.Also, when I tried to diagnose the problem using xdebug, I set a breakpoint in recaptcha_v3.module, line 208. What I saw there was
$user_input['captcha_response']was an empty string.Comment #9
mnico commentedHello, I also had the problem and reviewing I could see that when migrating from
core/jquery.oncetocore/onceit was still considered to usevar element = this, when the element variable must come as an argument inforEach(). Check the patch: https://git.drupalcode.org/project/recaptcha_v3/-/merge_requests/2.diffWith this I was able to solve it
Regards
Comment #10
anup.singh commented+1 , the suggestion from #9 worked for me too.
this was always "undefined"
Comment #11
mnico commentedComment #12
awasson commented@dench0,
I can take any screenshots to help. Let me know what you'd like. The Paragraph Config for my Webform bundle or the Display Settings? I've got a field on Basic Page called Paragraphs where I place them. I can also export the configs. Let me know which ones you'd like as in Basic Page + Paragraph bundle + fields.
Interestingly enough on a local clone of the site, I get a similar error to #6 @paulmckibben where it says The response parameter is invalid or malformed. Expected hostname did not match.
In the meantime, I'll try the patch on #9 and see if that allows the Recapcha to complete.
Cheers,
Andrew
Comment #13
awasson commentedJust following up.
The patch at #9 appears to be working. I don't have any way to test to make sure that it will block spam but it isn't blocking legitimate submissions and no errors are reported. This could be the fix.
@dench0,
Just to follow up on the difference of the Captcha Point in the Form Settings. I have my Paragraph Field Display settings to Set submission source entity: No whereas I am certain you have yours set to Yes. I have tried it both ways prior to patching the module and neither way worked for me.
When I had mine set to Yes, my Captcha Point in the Form Settings was set to: webform_submission_contact_paragraph_232_add_form
Cheers,
Andrew
Comment #14
kurttrowbridgeThe supplied patch is working here as well—we had a site with the same error described in the original issue, and the patch has restored the ability to submit forms that weren't working without it. Based on that and #13 above, marking as RTBC. Thanks for the quick turnaround on this!
Comment #16
dench0Thanks, guys, I merged it and going to create a new release.
Comment #17
awasson commentedThanks @dench0,
Nice turnaround on the fix and excellent work on that patch @mnico.
Cheers,
Andrew
Comment #18
jimconte commentedFYI this also impacts ReCaptcha V3 when implemented as a component of Webform "captcha"
Thanks for the fix!
-Jim
Comment #20
mandras87 commentedIf anybody still got this error, this patch may help you
It's fix a JS issue that cause the error "The response parameter is missing" (with no errors in console logs)
If needed, here the documentation for the jQuery each method: https://api.jquery.com/each/
Comment #21
dench0Hi @Mandras87,
You definitely using the old code. The new one uses javascript forEach instead of jQuery each.
https://git.drupalcode.org/project/recaptcha_v3/-/blob/8.x-1.x/js/recapt...
Comment #22
dench0Comment #23
seanrThis is still extant in 2.0.2
Comment #24
poker10 commented@seanr Can you open a new issue for this? We are also getting similar errors from bots even on 2.0.2.
Comment #25
karingIs there a new issue for this? I just noticed this exact error on a /form - Drupal 10.3
Even after updating to latest versions:
Comment #26
orkutmuratyilmaz@dench0 can you reactivate this issue?
Comment #27
sébastien-frI just configured recaptcha v3 with v2 in fall back. I also have this error in the logs.
The form is /user/register
Module :
CAPTCHA 2.0.7
reCAPTCHA 8.x-3.4
reCAPTCHA v3 2.0.3
Comment #28
dench0@sébastien-fr
1. Are there any errors in the browser console?
2. Check this commentary . Do you see the element and does it have a value?
3. Check if the captcha value is sent with form data on form submission.
There are some similar issues, you can review them as well.
Someone helped just create a new site in the google console.
Comment #29
sébastien-frHello @dench0
The markup seems ok :
<input id="recaptcha-v3-token" class="recaptcha-v3-token form-control" data-recaptcha-v3-action="recaptcha_v3" data-recaptcha-v3-site-key="...How can I check if the captcha value is sent with form data on form submission on a registration form ?
Comment #30
dench0Is there a token value?
In the browser developer tools - on the network tab.
Again this was already discussed in some of the previous issues: e.g. here.
I don't mean to be rude, but I highly recommend that you check issues before creating a new question: there are only 15 issues with the "Google reCAPTCHA v3 validation failed" and it should not take a lot of time to check them.
Comment #31
subir_ghoshI am getting this in 2.0.4.
The response seems to be related only to bots.