go-oidc
go-oidc copied to clipboard
NewProvider() returns unexpected EOF from time to time
Hey team,
We're using go-oidc lib to create new providers for authentication (via this method) and we noticed the GET request frequently returns "unexpected EOF" error. However, whenever we curl the same endpoint, it always succeeded.
Do you happen to know why this error would happen? Some browsing on the internet suggests adding req.Close = true but I'm not sure if that's the problem. Could you please help us out? Really appreciated!!
Is there a specific provider your dealing with? Are you using HTTP/2 or another protocol? Is that during io.ReadAll or somewhere else?
I believe req.Close is used to disable keep alives, so it shouldn't be enabled everywhere.
https://pkg.go.dev/net/http#Request
Have you considered using https://pkg.go.dev/net/http/httptrace to debug?
Hi @ericchiang, we have control on our provider domain but this shouldn't be provider specific. And we do use https. Based on the errors unexpected EOF, I don't think it's from io.ReadAll, otherwise we should be seeing error starting with unable to read response body right? That being said, I have no idea which call failed exactly in NewProvider().
Regarding httptrace, we don't have context on that but we could give it a try. Meanwhile if you can provide any insight for us to understand the error better, we will really appreciate it!