vercel / next-react-server-components

Demo repository for Next.js + React Server Components
https://next-rsc-hn.vercel.app
MIT License
979 stars 158 forks source link

Cannot set headers after they are sent to the client #5

Closed mnai01 closed 2 years ago

mnai01 commented 2 years ago

Repro Steps:

  1. git clone
  2. remove yarn from package.json so i can use npm to start
  3. npm run dev
Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:518:11)
    at DevServer.renderError (C:\Users\Admin\Documents\Javascript\FullStack\Next.js-Strapi-Template\next-rsc-demo\node_modules\next\dist\server\next-server.js:1631:17)
    at DevServer.run (C:\Users\Admin\Documents\Javascript\FullStack\Next.js-Strapi-Template\next-rsc-demo\node_modules\next\dist\server\dev\next-dev-server.js:431:35)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  code: 'ERR_HTTP_HEADERS_SENT'
}
error - TypeError [ERR_INVALID_ARG_TYPE]: The first argument must be of type string or an instance of Buffer. Received an instance of Uint8Array
error - unhandledRejection: undefined
error - unhandledRejection: TypeError: The stream (in errored state) is not in the writable state and cannot be closed
shuding commented 2 years ago

Could you clone the latest repo again? Thanks! I think we’ve fixed this issue.

mnai01 commented 2 years ago

Updating node.js seemed to help too. Was using v12 and updated to LTS v16 and it worked fine