imorente / gatsby-netlify-form-example

Example site integrating Netlify's form handing in Gatsby's starter template
MIT License
138 stars 32 forks source link

Can't get my own version of the reCAPTCHA form working #15

Closed grantavery closed 4 years ago

grantavery commented 5 years ago

Hello, I cloned this repo and replaced "process.env.SITE_RECAPTCHA_KEY" with my own reCAPTCHA public key, then deployed it to Netlify (keen-montalcini-705d75.netlify.com) using my own GitHub repo (https://github.com/GrantAvery/GatsbyRecaptchaTest). As you can see if you go to the site, the reCAPTCHA displays this error: image

I have doublechecked that the Netlify's build variables match the reCAPTCHA v2 site (https://www.google.com/recaptcha/admin#site/344660201 (I don't think it will let you view the specific page)) and my code: image

Is there something else in the setup that I'm missing? What am I doing wrong?

It could have to do with this part of the README; I can't find that line in the repo so I'm not sure what I'm supposed to do about it:

Change the build command for your site to echo SITE_RECAPTCHA_KEY=$SITE_RECAPTCHA_KEY >> env.production && gatsby build This will make the SITE_RECAPTCHA_KEY available to the Gatsby build in production.

To see the reCAPTCHA widget locally, add SITE_RECAPTCHA_KEY=your-reCAPTCHA-API-site-key to your local .env.development file.

I've been trying to implement this type of form on my own site for several days now without success, so any help would be greatly appreciated.

imorente commented 5 years ago

@GrantAvery, that error seems unrelated to Netlify. I've seen it happen when the reCAPTCHA API key is misconfigured, for example, when you forget to add the domain to the Key settings in https://www.google.com/recaptcha/admin#site/344660201 (I can't access that URL so I'm not certain that's exactly what's missing)

grantavery commented 5 years ago

Thanks, yeah I must have done something wrong on that end because when I created a new recaptcha on the google site, it started working.

However, I am having trouble getting the submitted forms into Netlify. I'm not seeing any errors, the recaptcha was successful, and it redirects to my /thanks page, but the submissions never make it into the Netlify dashboard. This issue is happening on my personal site (https://www.grantavery.com/) and my clone of your example (https://keen-montalcini-705d75.netlify.com). Any ideas on why that would be happening?

grantavery commented 4 years ago

Finally went back to this issue and was able to get it working just fine with a fresh set of reCAPTCHA credentials, not sure what was wrong originally.