You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for reporting, @Gerhut ! I do indeed see the Node.js docs have updated to note that req.socket is no longer guaranteed to be there, and that there is a code path within Node.js itself that now unsets it. I will get a patch out for this module to account for this new behavior.
Sorry for the delay on this. It seems very convoluted on when exactly Node.js will make req.socketnull. I see that there is a guard against that in req.destroy(), though not a lot of other methods on req. I believe we can just call req.destroy() anyway, just verifying that will behave as expected across the supported Node.js versions of this module before landing, as it would be the simplest solution 👍
@dougwilson Any luck with this? I'm running into an occasional error where req.socket is null and req.socket.destroy ends up blowing up.
Undici in particular is clearing out the socket when we stream a request through it and the connection is suddenly killed.
See discussion in nodejs/undici#1115, nodejs/node#41011.
There will be
TypeError: Cannot read properties of null (reading 'destroy')
when using req as body in undici.stream, which sets req.socket to null.The text was updated successfully, but these errors were encountered: