code: 'ECONNRESET' failed, reason: socket hang up 0|server | at ClientRequest.<anonymous> ... nextjs

1.8k views Asked by At

Since two I get this error I want to deploy nextjs with node server to my vps debian server, I had uninstall debian server to expected the problem will solve , i check if the port is using by another process but the port is not using , I run the app with cluster mode, the problem is not solve I has read a lot answere on the websides and test many solution the problem is not solve , please how can I fix this

System : debian 10 vps server

webside : nextjs

server: nodejs

database: mariadb

0|server  | FetchError: request to http://localhost:5000/getProduct failed, reason: socket hang up
0|server  |     at ClientRequest.<anonymous> (/home/webmin/pm2Stuff/decirshop/node_modules/next/dist/compiled/node-fetch/index.js:1:147710)
0|server  |     at ClientRequest.emit (events.js:315:20)
0|server  |     at Socket.socketOnEnd (_http_client.js:453:9)
0|server  |     at Socket.emit (events.js:327:22)
0|server  |     at endReadableNT (_stream_readable.js:1220:12)
0|server  |     at processTicksAndRejections (internal/process/task_queues.js:84:21) {
0|server  |   type: 'system',
0|server  |   errno: 'ECONNRESET',
0|server  |   code: 'ECONNRESET'
1

There are 1 answers

0
MOUTAIROU Bastou Abdel On

I solved the problem the problem is that mysql2/promise query would not respond to the request which leads the proxy to block the connection .I changed mysql2/promise to mysql so generally it is a the connection problem too long