The http2 client relies on the http/1.1 client doing the dial and uses its established connections - this error shows up when the http/1.1 client has no pooled TLS connections for the http2 client to use.
The issue is that the httptest server is using a self-signed certificate, the client hasn’t been configured to trust it, thus it’s unable to create any valid TLS connections for the http2 client to use. It seems unfortunate that it’s returning a pool error and not “certificate signed by unknown authority”, which would’ve been more clear. https://gist.github.com/elindsey/0a98a3784fb059fd4458afe70b7737ee is an example of how to trust the cert from httptest.Server and passes locally for me. -eli > On Dec 12, 2023, at 9:12 AM, Nik Steffen <dominik.stef...@gmail.com> wrote: > > Hi fellow gophers, > > I already asked my Question on r/golang but could not get an answer despite > >2500 views. So i wanted it to try here as i imagine people are a little more > in the hard stuff. > > Currently I am struggling with a problem regarding an http2 client playing > around with an issue in our system where http2 could help solving the > problem. For this I created the following test gist. I did this after facing > the same problem I am describing in this post in a test implementation in our > real test system. So I wanted to isolate the test case. > > https://gist.github.com/niksteff/7d39c6f674a7bf98d71ad2c3add68f94 > > In this gist I am running an http1.1 and http2 server and sending the a > request to both - each from it's corresponding client. Go Version is 1.21.4 > for the example. > > Currently the http2 client does not reach the server as the following error > occurs: > > http2: no cached connection was available > I'm all out of ideas what is missing but i suspect something in the http2 > client configuration? > > Anybody able to help? What am I missing while configuring the client? > > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com > <mailto:golang-nuts+unsubscr...@googlegroups.com>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/08f74129-a14f-418a-a87f-fd6e47d095ccn%40googlegroups.com > > <https://groups.google.com/d/msgid/golang-nuts/08f74129-a14f-418a-a87f-fd6e47d095ccn%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/F004190A-5BE9-491C-8057-4606A765E303%40siliconsprawl.com.