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
I also encountered this bug now when attempting to do consecutive calls to an API. One workaround I found was to include a await new Promise(resolve => resolve(setTimeout)); before the await fetch. So there is probably a synchronization bug somewhere.
The same code base works as expected with node 18, so I switched to that for now.
Technically this kind of issue should only occur in test purpose. Another solution is to change the port between each test.
If you make repeated requests to a server in production, and the connection closes between requests, it could happen in production as well. Servers do restart sometimes in real life.
Repeating a request to a server after it's been closed and re-opened seems to try to re-use the prior connection, resulting in ECONNRESET.
Reproduction
Steps to reproduce the behavior:
Using node 20.6.1
Expected behavior
Connection is closed, so it is not re-used.
Screenshots
Your Environment
Additional context
Worked fine in node 18. I haven't dug into what might have changed, but perhaps the connection close isn't being surfaced in the same way?
Node's built-in
http.request()
works in this scenario without any problem.The text was updated successfully, but these errors were encountered: