How to process.exit(1) from NextJS app

Currently I´m trying to `process.exit(1) from inside a nextjs app runnig in standalone mode inside a container. But I cannot get the process (and container) to be terminated. Instead I get a
Error: socket hang up
at connResetException (node:internal/errors:705:14)
at Socket.socketOnEnd (node:_http_client:518:23)
at Socket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ECONNRESET'
}
Error: socket hang up
at connResetException (node:internal/errors:705:14)
at Socket.socketOnEnd (node:_http_client:518:23)
at Socket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ECONNRESET'
}
8 Replies
reymon359
reymon35910mo ago
Hey @nsttt did you find a solution?
Nestor
Nestor10mo ago
Nop, and I should keep the thread alive once again because I believe it died In github
reymon359
reymon35910mo ago
Thanks for answering! do you remember if this was related to upgrading the node version or Next.JS?
Nestor
Nestor10mo ago
its nextjs
reymon359
reymon35910mo ago
awesome, could you please tell me which versions of node and nextjs are you using for your deployment? 🙏
Nestor
Nestor10mo ago
GitHub
Allow exit on failure kind of behaviour · Issue #88 · t3-oss/t3-env
When using t3-env on a container scenario, it will be useful to force a process.exit when invalid variables are detected. This is due to container environments usually relying on different containe...
Nestor
Nestor10mo ago
This is the original issue I have to reopen it with the repro
reymon359
reymon35910mo ago
thanks for sharing. I may be wrong but I can't see anything related to the original error in the issue 🤔
Error: socket hang up
at connResetException (node:internal/errors:705:14)
at Socket.socketOnEnd (node:_http_client:518:23)
at Socket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ECONNRESET'
}
Error: socket hang up
at connResetException (node:internal/errors:705:14)
at Socket.socketOnEnd (node:_http_client:518:23)
at Socket.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1358:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ECONNRESET'
}