400 and 500 on Next.JS Form Submission

I changed the code to POST to __forms.html and it started working.
Weirdly enough, I went back to the other code which was giving me a 400 and that was now working as well and I was no longer getting then 400 even though I didn’t change anything, I simply reverted the git commit history.

Solution was:

  1. Code exactly as in the post Next JS 14.2.4 Form submissions except I modified the POST to go to /__forms.html instead of /
    Or,
  2. Code exactly as in the documentation (though it didn’t work at first).