-
-
Notifications
You must be signed in to change notification settings - Fork 936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request hangs up with GOT v11 #1287
Comments
I cannot reproduce: https://runkit.com/szmarczak/5ed626c21e7b4f001a7c618c |
I think this might the issue we're currently having in our project. Minimal repo (Node v12.18.0) (edit: added
Any idea of what's wrong here or should I open a new issue? |
About the cache problem (raised by @michael42) I can say that, on the second request, the @szmarczak |
Then the promise resolves with a Response and |
Lines 1315 to 1319 in cb4da8d
Lines 1464 to 1478 in cb4da8d
|
I mean it should, but I haven't checked. I've been busy for a while and will be for 2 more weeks. |
With some "High quality debugging" (
I'm going to look into why that doesn't happen. |
That's actually not correct, because the promise is resolved by this event, that occur before the callback, with the request. Line 1326 in cb4da8d
|
Then for some reason it doesn't have |
That's because You were using the |
|
Similar Issue: const headersToSend={"authorization": "Bearer ..."};
const response = await got(this.url, { headers: headersToSend, timeout: 1000 }); In version: 10.7.0 works!! |
This issue is unrelated to the previous, because the problem was due to the cache. Anyways, it's still an issue, but I can't reproduce it. Take a look at this code and tell me if it reflect your case. import got from 'got';
import express = require('express');
const app = express();
app.use('/', (_req: any, _res: any, _next: any) => {});
(async () => {
const server = app.listen(4444);
await got('http://127.0.0.1:4444/', {
headers: {"authorization": "Bearer SOMETHING"},
timeout: 1000
});
console.log('END');
server.close();
})(); |
First, thanks for your reply. However, I have been isolating the issue and I figure out that it is an issue related with got and Node 10.15.1 version. In newer Node version, got 11 works correctly. The interesting things is that using got in version 10.7.0 works also in Node 10.15.1. In this repo I have reproduced the problem. |
I found something. This issue has nothing to do with the The thing is that got seems to have problem with the gzip compression. The postman echo decides to use gzip only if the size of the body exceed a certain size, with express I found that the minimum body size is 1Kb. Code to reproduce import got from "../source";
import express = require("express");
const compression = require('compression');
const app = express();
app.use(compression({ filter: (_req: any, _res: any) => true }));
app.get("/", (_req: any, res: any, _next: any) => {
let body = '';
for(let i=0; i<1024; i++) body += 'a';
res.end(body);
});
(async () => {
const server = app.listen(4444);
try {
await got("http://127.0.0.1:4444");
console.log("END");
} catch {
console.log("ERROR");
}
server.close();
})(); A workaround could be removing the compression |
Since it's not happening on Node.JS v10.21.0 that's the latest 10 available, nor on the v10.15.3 I would conclude that's some kind of bug of Node.JS v10.15.1. TL;DR Update Node.JS |
I can reproduce #1287 (comment) on |
Indeed, it is working as expected on |
So I figured out what happens. It sends a request to verify the cache, so |
Describe the bug
Actual behavior
Request gets stuck while downloading.
...
Expected behavior
Request should either timeout or give correct response
...
Code to reproduce
Checklist
The text was updated successfully, but these errors were encountered: