HTTP 500 on Netlify form when submitting

The Setup

I have forms across several sites and they all handled submissions fine until a few days ago (around May 1st, 2022), ever since then they have been returning HTTP 500. All of these sites are built against vLatest of Hugo, and uses “Ubuntu Focal 20.04 (default)” as the build agent.

Here is an example of my form:

<form name="contactForm" method="POST" netlify>
    <input type="hidden" name="form-name" value="contact">
    <p>
        <label>Your Name: <input type="text" name="name" /></label>
    </p>
    <p>
        <label>Your Email: <input type="email" name="email" /></label>
    </p>
    <p>
        <label>Message: <textarea name="message"></textarea></label>
    </p>
    <p>
        <button type="submit">Send</button>
    </p>
</form>

As you can see this is almost exactly the same as the example HTML form. I do not use JavaScript on any of the sites which have these forms.

The Problem I’m Having

All submissions to my HTTP forms since around May 1st, 2022 have been returning HTTP 500 errors across all sites. These forms do not have ReCaptchas, and submissions are coming from external (to me) users of the sites - mostly funnelled there from Twitter; each user reports an HTTP 500 error (they are all developers).

Here is a screenshot of the Chrome developer tools showing the HTTP 500 error:

I have censored the URL of the site in question as I didn’t think that it was pertinent, but will happily reply with a link to the page in question.

In an effort to get some logs as to what is going on, I attempted to post some data to the form from cUrl. I don’t know whether this should work for Netlify forms, but figured it would be worth a shot to gather some information:

curl -v -X POST -F "form-name=contactForm" -F "bot-field=" -F "name=Jamie" -F "message=This+is+jamie%27s+test+message+here+yo%21" -F "email=jamie%tld.com" https://PAGE-URL/2022-ama/
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 206.189.50.60:443...
* Connected to PAGE-URL (206.189.50.60) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*  CAfile: /etc/ssl/certs/ca-certificates.crt
*  CApath: /etc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server accepted to use h2
* Server certificate:
*  subject: CN=PAGE-URL
*  start date: Mar  9 20:00:29 2022 GMT
*  expire date: Jun  7 20:00:28 2022 GMT
*  subjectAltName: host "PAGE-URL" matched cert's "PAGE-URL"
*  issuer: C=US; O=Let's Encrypt; CN=R3
*  SSL certificate verify ok.
* Using HTTP2, server supports multi-use
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x558238a415e0)
> POST /2022-ama/ HTTP/2
> Host: PAGE-URL
> user-agent: curl/7.74.0
> accept: */*
> content-length: 595
> content-type: multipart/form-data; boundary=------------------------3d57432a3b448cf6
> 
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* We are completely uploaded and fine
* Connection state changed (MAX_CONCURRENT_STREAMS == 250)!
< HTTP/2 500 
< age: 1
< date: Tue, 03 May 2022 08:35:18 GMT
< server: Netlify
< x-nf-request-id: 01G24GYE9Z72HS2TCVABKXXBFS
< content-length: 0
< 
* Connection #0 to host PAGE-URL left intact

As you can also see from the log, there is a 500 (Internal Server Error) code returned from the server. I have no idea whether this is Netlify or Akismet returning this error, though.

I have also attempted to submit the form using JavaScript in the Chrome developer tools and get a similar (500) response:

> myForm = document.getElementById("contact-form");

<form class=​"form-meghna" id=​"contact-form" method=​"post" name=​"contactForm" role=​"form">​…​</form>​

> formData = new FormData(myForm);
FormData {}

> response = await fetch('/contact', {
  method: 'POST',
  body: new URLSearchParams(formData).toString(),
  headers: {
    'Content-type': 'application/x-www-form-urlencoded'
  }
})

VM1212:1 POST PAGE-URL/contact net::ERR_ABORTED 500
(anonymous) @ VM1212:1

Response {type: "basic", url: "PAGE-URL/contact", redirected: false, status: 500, ok: false, …}
    body: (...)
    bodyUsed: false
    headers: Headers {}__proto__: Headers
    ok: false
    redirected: false
    status: 500
    statusText: ""
    type: "basic"
    url: "PAGE-URL/contact"
    __proto__: Response

The form used in the JS example doesn’t match the form pasted at the top of this post, but the only change differences are the class, id (to make it easier to grab in JavaScript) and role attributes.

I did have a slightly more complex form (within a shortcode, with the ability to pass in the target name of the form. But that was the only difference), but have completely replaced this with the much simpler form above.

The Netlify UI shows that none of the forms across any of my sites have had submissions (either verified or spam) since May 1st, 2022 - this is despite users in many different geo-locations and using varied modern browsers (vLatests of Edgium, Chrome, and Firefox have been confirmed).

I have run through the [[Support Guide] Form problems, form debugging, 404 when submitting]([Support Guide] Form problems, form debugging, 404 when submitting) and have searched the forums for related topics but am unable to find anything which directly seems to match my setup.

My initial thinking is that by replacing the form with Netlify’s default example means that either I’m not including some kind of data on my form or that the users are submitting data which is being picked up as spam by Askismet. Although, part of me is now thinking that there might be a problem at Netlify’s end for receiving my forms.

Any help or advice would be greatly appreciated.

Hey @GaProgMan

One issue is the hidden form-name value needs to match the name of the form e.g

<form name="contactForm" method="POST" netlify>
    <input type="hidden" name="form-name" value="contactForm">

Without a site to look at, it makes it hard to test and offer further advice.

That’s a really good point @coelmay. I’ll change that on my branch and try again. Will report back.

Worth noting that on my main branches (which represent the live sites), the form-name input value matches the name of the forms involved.

So I’ve ensured that all forms have a correct hidden input for the form name, as pointed out by @coelmay, yet I’m still seeing the issue.

Hello @GaProgMan!

We’ve applied an internal fix that solves your issue. Thank you for the detailed report that quickly led us to the source of the problem.

2 Likes

@paulo oh, there was an internal issue?

I’m glad that I could help point you all in the right direction.

1 Like