Home
Support Forums

Nextjs and proxied requests error

Hi there,

We are experiencing an issue when we are using an HTTP proxy on Netlify. All proxied requests are failing with the following error:

{
“errorType”: “Runtime.UnhandledPromiseRejection”,
“errorMessage”: “Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client”,
“trace”: [
“Runtime.UnhandledPromiseRejection: Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client”,
" at process. (/var/runtime/index.js:35:15)",
" at process.emit (events.js:314:20)",
" at processPromiseRejections (internal/process/promises.js:209:33)",
" at processTicksAndRejections (internal/process/task_queues.js:98:32)"
]
}

This issue appears only on Netlify, if you run the project locally or on Vercel there is no issue.

You can find the source code of a reproducible case on: GitHub - matthieuh/nextjs-netlify-issue

The application is deployed on

Any idea of the root cause of this issue?

Hey there!

I replied to your Helpdesk post. For posterity, this issue is well documented and I’d encourage you to reach out to the team there if none of those posts align with your observations. Failing that, our Next gurus may be able to help.

1 Like