With http2 "socket hang up"
See original GitHub issueI’m using supertest on Windows 10 and node 12.14.1 with great satisfaction.
However, if I switch my server to http2 all tests fail. They prints only socket hang up
and nothing more. My server is Koa and tests are written with typescript. Here is an excerpt:
import http2 from "http2";
const app = new Koa();
const options = {
key: fs.readFileSync(path.join(__dirname, "cert", "privkey.pem")),
cert: fs.readFileSync(path.join(__dirname, "cert", "cert.pem"))
};
const server = http2
.createSecureServer(options, app.callback())
.once("error", handleServerErrors)
.listen(3111, () => runApp("https"));
request = supertest(server);
Any ideas? Everything runs smoothly if I use http and createServer()
Thanks! mario
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Node.js HTTP2 server Error: socket hang up - Stack Overflow
The "hang" occurs when a HTTP1 client connects to a HTTP/2 server with allowHTTP1: true set but doesn't handle the HTTP/1 request.
Read more >Error: socket hang up with 15.7.0 or newer · Issue #37510
I filled it with free socks5 proxy. const request = require('request'); const Agent = require('socks5-https-client/lib/Agent'); let ip = { url ...
Read more >NodeJS - What does socket hang up actually mean - Edureka
When a socket hang up is thrown, one of two things happens: When you're a customer, When you send a request to a...
Read more >Socket hang up problems - Google Groups
Hi, I've been getting this issue every now and then on a long poll request. It doesn't happen consistently so I'm finding it...
Read more >502 Bad Gateway - Socket hang up | Apigee Edge
The error code [socket hang up][ECONNRESET] indicates that the target server has closed the connection with Edge Microgateway. This can be ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Given the date of this issue, it should be
supertest@<=5.0.0-0
. Back then,http2
wasn’t supported bysupertest
.Nevertheless, this http2 feature has been incorporated into
supertest@6.3.0
(PR #793). A sample code snippet is in theREADME.md
.Based on your code, I would reckon it would be something like:
Closed via https://github.com/visionmedia/supertest/pull/793 and released in v6.3.0