Skip to content
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

How to handle HTTP/2 GOAWAY ? #2156

Closed
1 task done
Raphael0010 opened this issue Oct 4, 2022 · 4 comments
Closed
1 task done

How to handle HTTP/2 GOAWAY ? #2156

Raphael0010 opened this issue Oct 4, 2022 · 4 comments

Comments

@Raphael0010
Copy link

What would you like to discuss?

Hi, I'm looking a way to handle this : "New streams cannot be created after receiving a GOAWAY".
I have read the RFC7540 about the GOAWAY frame, but I'm questioning if they exist a way to handle it with got ?

According to the RFC : To deal with this case, the GOAWAY contains the stream identifier of the last peer- initiated stream that was or might be processed on the sending endpoint in this connection..

So I should re-open the connection with this last stream identifier, but how I can get it with got ?

Checklist

  • I have read the documentation.
@szmarczak
Copy link
Collaborator

I should re-open the connection with this last stream identifier

You don't. You create a new stream. IOW you just call got as usual.

@prabhatmishra33
Copy link

Hi @szmarczak @Raphael0010 ,
I get the same error, can you please tell me how to deal with it?

Do I need to simply retry the request and everything would just work fine?

@yovanoc
Copy link

yovanoc commented Oct 11, 2022

We don't know. I have the same problem too but @szmarczak close this issue abruptly. I think too is not normal that simple requests fails like that

@mkaufmaner
Copy link

mkaufmaner commented Oct 27, 2022

@Raphael0010 @prabhatmishra33 @yovanoc @szmarczak

I ended up running into this error as mentioned in the szmarczak/http2-wrapper#89 bug. I ended up forking the http2-wrapper library, made the following changes https://github.com/szmarczak/http2-wrapper/pull/90/files , published the forked library for personal use, and passed the new http2-wrapper.auto in the got request option as seen here.

// this is an example DO NOT USE
import http2wrapper from '@mkaufmaner/http2-wrapper';
import got from 'got';

const {headers} = await got(
	'https://httpbin.org/anything',
	{
		http2: true,
		request: http2wrapper.auto
	}
);

console.log(headers[':status']);
//=> 200

I was able to validate my fix through e2e testing but an integration test for it still needs to be created in the http2-wrapper project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants