Netlify Next.js Server Handler function erroring every second, causing 502 crash on live site

Hi,

My client’s site is crashing, with 502 errors and an Invocation Failed message on all pages.

I’ve moved the site to co-supermarket.netlify.app, though that is not the primary domain (where the errors are occuring).

The builds are working. Here is the error from the Next.js Server Handler function logs. This error repeats every second:

Dec 10, 04:38:10 PM: 03efa9ef ERROR Uncaught Exception {“errorType”:“TypeError”,“errorMessage”:“Cannot read properties of undefined (reading ‘toString’)”,“stack”:[“TypeError: Cannot read properties of undefined (reading ‘toString’)”," at Yd.prepareHeaders (file:///var/task/___netlify-bootstrap.mjs:2:99473)“,” at Yd.annotateFromRequest (file:///var/task/___netlify-bootstrap.mjs:2:98884)“,” at Yd.onRequestCreate (file:///var/task/___netlify-bootstrap.mjs:2:100758)“,” at Channel.publish (node:diagnostics_channel:141:9)“,” at new Request (node:internal/deps/undici/undici:7396:27)“,” at [http1 build request] (node:internal/deps/undici/undici:7497:16)“,” at [dispatch] (node:internal/deps/undici/undici:8609:139)“,” at Intercept (node:internal/deps/undici/undici:8289:20)“,” at [Intercepted Dispatch] (node:internal/deps/undici/undici:6856:16)“,” at Client.dispatch (node:internal/deps/undici/undici:6872:44)"]}

The site is on Next 14.2.3 and React 18

In the Web Security Tab from the client Netlify instance, there was a large spike of allowed traffic two days ago:

Any help would be much appreciated! Thank you.

https://netlify.zendesk.com/agent/tickets/479457

Hey @johnny1 :wave:,
Thanks for reaching out!

We’ve gone ahead and created a support ticket for you, so our team can follow up with you directly via email from the help desk. Our Support crew will be in touch with you by email soon.

Great news: these days anyone can reach out to Netlify Support. First, you can try getting an answer using Ask Netlify, our helpful AI search tool. If your question isn’t answered there, you can submit a ticket using the support form, and we’ll take it from there.

We’re keeping the community around for swapping ideas, sharing tips and tricks, and talking shop with other folks building on the platform — but for support issues, tickets are the way to go.

Thanks for being here, and keep an eye out for that email from us!