Netlify form submission crash on submit nextjs

Hello,
My site is:

I have successfully created a couple of forms in /contatti and /newsletter paths, the site is built on nextjs.
I was receiving submissions correctly until october 31st. Since yesterday (November 1st) any submission will crash the application with this message:

This function has crashed

An unhandled error in the function code triggered the following message:

2023-11-02T17:28:23.980Z 26ba803c-3559-44a9-ba53-7d4b5243773f Task timed out after 10.02 seconds

Connection details

Netlify internal ID: 01HE8H84KYBC5VFH07MG738Q7S

The logs have no further info.

Nov 2, 08:28:56 PM: INIT_START Runtime Version: nodejs:18.v15 Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:8ed78fdc4678dbafe30d2afe48bcfb27097048de7858a6fbbba5d19fdc3419db
Nov 2, 08:28:57 PM: 2afee23f INFO [GET] / (SSR)
Nov 2, 08:28:57 PM: 2afee23f Duration: 1045.53 ms Memory Usage: 122 MB Init Duration: 384.17 ms
Nov 2, 08:28:58 PM: da726708 INFO [GET] /favicon.ico (SSR)
Nov 2, 08:28:58 PM: da726708 Duration: 70.79 ms Memory Usage: 123 MB
Nov 2, 08:29:03 PM: 30c22e18 INFO [GET] /blog/news/ottobre?_rsc=acgkz (SSR)
Nov 2, 08:29:03 PM: 30c22e18 Duration: 25.58 ms Memory Usage: 123 MB
Nov 2, 08:29:03 PM: a3b11ea7 INFO [GET] /blog/news/novembre?_rsc=acgkz (SSR)
Nov 2, 08:29:03 PM: a3b11ea7 Duration: 10.72 ms Memory Usage: 124 MB
Nov 2, 08:29:03 PM: INIT_START Runtime Version: nodejs:18.v15 Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:8ed78fdc4678dbafe30d2afe48bcfb27097048de7858a6fbbba5d19fdc3419db
Nov 2, 08:29:04 PM: 1cffcb49 INFO [GET] /blog/storie/occhi-verdi?_rsc=acgkz (SSR)
Nov 2, 08:29:04 PM: 1cffcb49 Duration: 12.54 ms Memory Usage: 124 MB
Nov 2, 08:29:05 PM: d7235454 INFO [GET] /blog/storie/mai-abbastanza?_rsc=acgkz (SSR)
Nov 2, 08:29:05 PM: d7235454 Duration: 10.99 ms Memory Usage: 124 MB
Nov 2, 08:29:11 PM: 82b79928 INFO [GET] /newsletter (SSR)
Nov 2, 08:29:11 PM: 82b79928 Duration: 86.55 ms Memory Usage: 125 MB
Nov 2, 08:29:28 PM: 179045c2 ERROR Task timed out after 10.02 seconds
Nov 2, 08:29:28 PM: 179045c2 Duration: 10015.08 ms Memory Usage: 125 MB
Nov 2, 08:29:28 PM: INIT_START Runtime Version: nodejs:18.v15 Runtime Version ARN: arn:aws:lambda:us-east-1::runtime:8ed78fdc4678dbafe30d2afe48bcfb27097048de7858a6fbbba5d19fdc3419db

I have tried re-deploying with no success.

Any help is apreciated

I’ve increased your function timeout to 26 seconds, can you redeploy the site and let me know if you’re still running into this issue?

1 Like

Hello,
I triggered a redeploy and I’m now getting this error after form submission.

This function has crashed

An unhandled error in the function code triggered the following message:

2023-11-02T20:05:59.735Z d5099430-7b3e-468a-9c9e-d57d1e0c474f Task timed out after 26.03 seconds

Connection details

Netlify internal ID: 01HE8T87AFX9QH114ZC1F1JQZE

Unfortunatelly I have been unable to find a solution for this. Its only a couple of very simple forms that were working perfectly until a few days ago. Any other suggestions?

Here is the code for the newsletter form:

export default function NewsletterForm({ privacyLink }) {
    return (
        <div className="flex flex-col items-center justify-center max-w-[900px]">
            <form name="newsletter" method="POST" data-netlify="true" action='/form-success-newsletter' className="w-full lg:pt-5 ">
                <input type="hidden" name="form-name" value="newsletter" />
                <div className="flex w-full flex-wrap md:flex-nowrap gap-4 pb-5">
                    <Input type="email" isRequired label="email" variant="underlined" name="email" />
                </div>
                <div className="flex w-full flex-wrap md:flex-nowrap gap-4 pb-10">
                    <Checkbox name="privacy" color="default" isRequired><span>Ho letto e accetto la </span><Link href={privacyLink}>privacy policy</Link>
                    </Checkbox>
                </div>
                <div className="flex w-full flex-wrap md:flex-nowrap gap-4 pb-5">
                    <Button color="solid" size="lg" variant="flat" type="submit" className="bg-blue-200 w-full lg:w-fit" >
                        Invia
                    </Button>
                </div>
            </form>
        </div>

    )
}

and here is the html file with the fields:

<!DOCTYPE html>
<html lang="en">

<head>

</head>

<body>
  <form name="newsletter" netlify netlify-honeypot="bot-field" hidden>
    <input type="email" name="email">
    <input type="checkbox" name="privacy">
  </form>
</body>

</html>

Removing method=“POST” from the form does not crash the site with a function timeout but obviously no data is submited to the form.

Hi, are you still experiencing issues with your form? I just submitted a tester form submission and it went through okay.

Hello and thanks for the reply.
What you are seeing is an older version of the site which uses client side react (for testing purposes). The forms work fine in this version. The issue I posted about was with a newer version of the same site, built on Nextjs using SSR. The SSR function timeouts started happening after November the 1st for some reason without any code changes on my behalf. I have since migrated my forms to formspree with no issues whatsoever. I would obviously prefer to use the netlify native form functionality If the issue has been fixed.

Is this page being exported as HTML or is it rendering using SSR? If it’s the latter, it won’t work.

I was struggling to solve this issue as well with Next.js 14 on app router, but solved it.

Create a not dynamic route containing only the static HTML for the form. So I created a route “fakeform” with a page.tsx inside containing a basic HTML form including data-netlify=“true” attribute.

Now Netlify will pick up the form, and submitting from inside a react component also works.

1 Like