Velvet Star Monitor

Standout celebrity highlights with iconic style.

news

Golang gRPC connection client side error - "error reading server preface: http2: frame too large"

Writer Matthew Harrington

I'm writing a go client to consume

conn, err := grpc.DialContext(ctx, serverAddr, grpc.WithBlock(), grpc.WithReturnConnectionError(), getTransportCredential(false))

The above call hangs until context timeout and returns the following error

failed to dial: context deadline exceeded: connection error: desc = "error reading server preface: http2: frame too large"

getTransportCredential(insecure bool) is defined below

func getTransportCredential(insecure bool) grpc.DialOption { if insecure { return grpc.WithTransportCredentials(insecure2.NewCredentials()) } rootCAs, err := x509.SystemCertPool() if err != nil { panic(err) } if rootCAs == nil { fmt.Println("SystemCertPool is nil") rootCAs = x509.NewCertPool() } caCert := `-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----` if caCert != "" { // Append our cert to the system pool if ok := rootCAs.AppendCertsFromPEM([]byte(caCert)); !ok { fmt.Println("Couldn't add cert to the cert pool") } } creds := credentials.NewClientTLSFromCert(rootCAs, "") fmt.Printf("%+v\n", creds.Info()) return grpc.WithTransportCredentials(creds)
}

Could you please help me solve this problem?

I can grpcurl from my machine to the server and get a successful response.

1 Answer

maximum frame size of http/2 is 2^14 (16384)enter image description hereyou need to reduce yourself payload,

refer to: , page 76

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.