Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client

Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client
    at ServerResponse.setHeader (_http_outgoing.js:470:11)
    at ServerResponse.header (C:\Users\drico\Desktop\Projetos\Jul.IA\node_modules\express\lib\response.js:767:10)
    at ServerResponse.send (C:\Users\drico\Desktop\Projetos\Jul.IA\node_modules\express\lib\response.js:170:12)
    at ServerResponse.json (C:\Users\drico\Desktop\Projetos\Jul.IA\node_modules\express\lib\response.js:267:15)
    at Query.<anonymous> (C:\Users\drico\Desktop\Projetos\Jul.IA\controladores\processos.js:19:14)
    at Query.<anonymous> (C:\Users\drico\Desktop\Projetos\Jul.IA\node_modules\mysql\lib\Connection.js:502:10)
    at Query._callback (C:\Users\drico\Desktop\Projetos\Jul.IA\node_modules\mysql\lib\Connection.js:468:16)
    at Query.Sequence.end (C:\Users\drico\Desktop\Projetos\Jul.IA\node_modules\mysql\lib\protocol\sequences\Sequence.js:83:24)    at Query._handleFinalResultPacket (C:\Users\drico\Desktop\Projetos\Jul.IA\node_modules\mysql\lib\protocol\sequences\Query.js:139:8)

A aplicação está persistindo normalmente os pagamentos e também retornando o pagamentos em json como respostas, mas dá esse erro no final. Pode gerar algum problemas futuro?

1 resposta
solução!

Consegui resolver. Estava usando o res.send duas vezes no mesmo fluxo.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software