-
-
Notifications
You must be signed in to change notification settings - Fork 536
Description
I have an express server application that handles a few NodeJS API and hosts the Angular 10 app. In production, I use process manager PM2. When the user visits https://domainname.com/webpage, the app crashes with the below error. PM2 restarts the application. To continue, the user has to refresh the webpage.
Error: EBADF: bad file descriptor, write
at Socket._write (internal/net.js:54:25)
at doWrite (_stream_writable.js:403:12)
at writeOrBuffer (_stream_writable.js:387:5)
at Socket.Writable.write (_stream_writable.js:318:11)
at Array.logRequest (C:\NODE_APPS\website\node_modules\morgan\index.js:130:14)
at listener (C:\NODE_APPS\website\node_modules\on-finished\index.js:169:15)
at onFinish (C:\NODE_APPS\website\node_modules\on-finished\index.js:100:5)
at callback (C:\NODE_APPS\website\node_modules\ee-first\index.js:55:10)
at ServerResponse.onevent (C:\NODE_APPS\website\node_modules\ee-first\index.js:93:5)
at ServerResponse.emit (events.js:327:22)
at onFinish (_http_outgoing.js:723:10)
at onCorkedFinish (_stream_writable.js:673:5)
at afterWrite (_stream_writable.js:490:5)
at afterWriteTick (_stream_writable.js:477:10)
at processTicksAndRejections (internal/process/task_queues.js:83:21) {
errno: 'EBADF',
syscall: 'write',
code: 'EBADF'
}
GetRegValue(): Unable to RegOpenKeyEx () The system cannot find the file specified.
If I don't use process manager PM2 and run the application like node bin\www
, everything works with no problem. It does randomly crashes with no error on the console. I am using an error handler called strong-error-handler. Application started using node bin\www
crashes randomly but less frequently. Application started using PM2 crashes as soon as the user access the webpage. The PM2 logs mention about the morgan. I don't know what the error message means but I will really appreciate any assistance in the correct direction. Thank you!