Next.js v 14.2.4 405 Method not Allowed on Form Submission

@artsycoder533 Yes, I’ve checked and confirmed that as you’d already mentioned it’s still being given a 404 response, which means there is also some other issue occurring.

But it doesn’t negate the steps we’ve done, they all still needed to happen.

The new question becomes, why is Netlify’s default handling still unhappy with what’s being sent?

Most people that I’ve assisted aren’t doing “file uploads”, so my first wild guess is that it’s probably related to that.

Checking the documentation they have:
https://docs.netlify.com/forms/setup/#submit-file-uploads-with-ajax

The crux of which is:

fetch("/", {
  body: new FormData(event.target),
  method: "POST",
})

You have:

const formData = new FormData(myForm);
const params = new URLSearchParams();
formData.forEach((value, key) => {
  params.append(key, value.toString());
});
const res = await fetch("/__forms.html", {
  method: "POST",
  body: params.toString(),
});

Which looks… very incorrect.

So it’s not occurring because you’re submitting files.
It’s that you aren’t submitting correct data at all.