next-runtime
next-runtime copied to clipboard
createProxyMiddleware on an api route is causing ERR_HTTP_HEADERS_SENT error
Describe the bug When using createProxyMiddleware on an API route it's causing an ERR_HTTP_HEADERS_SENT error when trying to change the header on the proxy request. Cf discussion: https://github.com/vercel/next.js/discussions/14057
To Reproduce Steps to reproduce the behavior:
- Clone https://github.com/matthieuh/nextjs-netlify-issue
- Use it locally or deploying somewhere else than on Netlify (live Vercel) it works (ex: https://nextjs-netlify-issue-h8fdnwit0-matthieuh.vercel.app/)
- Deploy it now on Netlify (ex: https://vibrant-wiles-df48c4.netlify.app/)
- Build will succeed but if you try to click on a button making a call to the proxy it will fire the ERR_HTTP_HEADERS_SENT error
Expected behavior Expecting to have it working on Netlify well or at least understand the reason why it's not.
Versions
- Next.js: 11.0.1
- plugin: 3.7.1
@matthieuh hey! so sorry no one seemed to touch on this. did you happen to find any sort of workaround? i know it's been awhile 😬 . we're in the middle of a plugin rewrite that hopes to address most of this existing plugin's issues so we're finally getting through to some of the lingering ones we've neglected. lmk - regardless, we will try to address this in the rewrite at some point!
Hi @matthieuh Could you try upgrading to version 4 of the plugin as see if the problem still occurs? Thanks!
Closing due to inactivity. If this is still an issue, please feel free to reopen this