Skip to content

Conversation

mikegreiling
Copy link

In certain circumstances, a request object's socket will be disassociated or destroyed prior to the response's finish event firing. In this case, req.socket will be null. This change ensures that the .on('finish') closure will reference the socket directly rather than referencing it through the request.

uncaughtException: TypeError: Cannot set properties of null (setting '_isIdle')
    at ServerResponse.<anonymous> (/Users/admin/Projects/home-portal/node_modules/http-graceful-shutdown/lib/index.js:160:26)
    at ServerResponse.emit (node:events:531:35)
    at onFinish (node:_http_outgoing:1031:10)
    at callback (node:internal/streams/writable:764:21)
    at afterWrite (node:internal/streams/writable:708:5)
    at afterWriteTick (node:internal/streams/writable:694:10)
    at process.processTicksAndRejections (node:internal/process/task_queues:81:21)

In certain circumstances, a request object's socket will be disassociated or destroyed prior to the response's finish event firing. In this case, `req.socket` will be `null`. This change ensures that the `.on('finish')` closure will reference the socket directly rather than the request.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant