Formik form submission with recaptcha not working

I am experiencing an issue with reCAPTCHA integration in a form that uses Formik for handling form state and validation. I have created a test project for recaptcha functionality. It is working fine on the test project but I am getting a 303 status code after submission in the main project.

Here is the link to the test project

The reCAPTCHA token is being set correctly in the state and added to the form data before submission. Despite this, the form submission fails, and I am unsure why.

Here are some images of the main code
image

Here is the payload
image

Hi @mukulSharma,

Thanks for reaching out and welcome to Netlify’s Support Forums!

We did update our docs here:

With information for Next.js with Netlify/Next.js runtime version 5.

We also have a Starter Template here:

With a Netlify form to see how it’s coded. The relevant parts here:

the .html file:

and the js/jsx:

If you want to compare your code to that of the template.

Could you give that a try and let us know if you continue to have issues?

Thanks for checking the query, everything in the form is working fine but when I add recaptcha, it returns 304 status code and the form is not being submitted.

Try removing the custom ReCaptcha.