hCaptcha/react-hcaptcha

Nextjs Invalid site key or not loaded in api.js

Closed this issue ยท 2 comments

Getting the folloring error on Nextjs

Invalid site key or not loaded in api.js

I am triggering the challenge async on submit of my form. I have a multistep form and loading the captcha in the parent and passing the ref into the component that runs this submit. Sometimes it does work but most of the time it fails.

const onSubmit = async ( ) => { try { let captchaRes = null; if (process.env.NEXT_PUBLIC_ENV !== 'local') { captchaRes = await captchaRef.current.execute({ async: true }); } .... } catch (err) {}

Found the issue, I hasnt remove google recaptcha v3 and it seemed to interfere with hCatpcha

Hi @fred-boink,

Great that the issue is fixed ๐Ÿ‘
Thank you for letting us know about the root cause!

Please feel free to contact us in case of any future issues.
Hope that you will have great experience using hCaptcha!

Best Regards,
IMI Dev Team