Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

236
Views
La redirección de NextJs en la página anterior arroja un error [ERR_HTTP_HEADERS_SENT]: no se pueden establecer encabezados después de que se envían al cliente

Tengo 2 páginas, la página del lobby y la página de la sala, cuando hago clic en un botón en el lobby, me redirige a la página de la sala. Luego, usando getServerSideProps, busco algunas cookies y, si no existen, quiero redirigir de nuevo a la página de lobby:

 export async function getServerSideProps({req, params}) { const cookie = JSON.parse(req.cookies.watchflix ?? null); if( !cookie ){ return { redirect: { destination: "/lobby", permanent: false, } }; } return { props: { cookies: cookie }, };}

y lanza:

 Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client at ServerResponse.setHeader (_http_outgoing.js:561:11) at NodeNextResponse.setHeader (H:\Projets\watchflix-client\node_modules\next\dist\server\base-http\node.js:59:19) at DevServer.renderError (H:\Projets\watchflix-client\node_modules\next\dist\server\base-server.js:1165:17) at DevServer.renderError (H:\Projets\watchflix-client\node_modules\next\dist\server\next-server.js:506:22) at DevServer.run (H:\Projets\watchflix-client\node_modules\next\dist\server\dev\next-dev-server.js:456:35) at async DevServer.handleRequest (H:\Projets\watchflix-client\node_modules\next\dist\server\base-server.js:321:20) {code: 'ERR_HTTP_HEADERS_SENT'}

Pero si redirijo a alguna otra página, funciona bien, solo cuando redirijo de nuevo al lobby hay un problema.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!