got: `Error: Premature close` on DELETE requests after upgrading to 10.0.3 (from 9.6.0)
Describe the bug
We updated from 9.6.0 to 10.0.3 and as soon as it was deployed, we started getting Error: Premature close
on most or all of our DELETE
requests. The GET
and POST
requests work fine.
Maybe some cases were missed in 7b2ccb0d69fca9aba27373ab344f97d389d692f2?
- Node.js version: v12.13.1
Actual behavior
Error: Premature close
File "internal/streams/end-of-stream.js", line 61, col 15, in IncomingMessage.onclose
File "events.js", line 210, col 5, in IncomingMessage.emit
File "domain.js", line 498, col 23, in IncomingMessage.EventEmitter.emit
File "/home/node/guardian-website/node_modules/@szmarczak/http-timer/dist/index.js", line 40, col 20, in IncomingMessage.origin.emit
return emit(event, ...args);
File "_http_client.js", line 363, col 11, in TLSSocket.socketCloseListener
File "events.js", line 215, col 7, in TLSSocket.emit
File "domain.js", line 498, col 23, in TLSSocket.EventEmitter.emit
File "net.js", line 659, col 12, in null.<anonymous>
File "_tls_wrap.js", line 481, col 7, in TCP.done
Expected behavior
We shouldn’t get a Premature close
error on successful DELETE
requests.
Code to reproduce
const url = "https://example.com";
const username = "username";
const password = "password";
const body = undefined;
const resp = await got(url, {
username,
password,
method: "DELETE",
throwHttpErrors: false,
responseType: "json",
json: body ? body : undefined,
});
Checklist
- I have read the documentation.
- I have tried my code with the latest version of Node.js and Got.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16
I’m able to reproduce it now, will post a fix soon.
@szmarczak I was on
got@10.0.3
but I dont see anything in 10.0.4 that would affect it.