Akka GRPC unsupported method PRI

Hello all

I have been working myself through the tutorial about akka-grpc and sadly nothing has worked so far. First I had decided to set up my akka-http server with http only and no https but with UseHttp2.always(). No matter what I tried with grpcurl I could not get anything to work (the command grpcurl -plaintext localhost:9999 list.

Everytime I tried it, I got the error that Illegal request, responding with status '501 Not Implemented': Unsupported HTTP method: PRI.

I then assumed I just have to bite the bullet and move to HTTPS. After many struggles I managed to get the handshake error gone so I could use grpcurl -insecure localhost:9999 list only to be greeted with…

Illegal request, responding with status '501 Not Implemented': Unsupported HTTP method: PRI.

I really dont know what else I could do. My application.conf enables http2 support for akk:
akka.http.server.preview.enable-http2 = on

My connection definition enforces http2:

        return ConnectHttp.toHostHttps(netInterface, port, UseHttp2.always())
                .withCustomHttpsContext(context);

It is really a pain to figure out what is going because there are literally 0 logs except that annoying “501 Not Implemented” message…

I also have:

		<dependency>
			<groupId>com.typesafe.akka</groupId>
			<artifactId>akka-http2-support_${scala.binary.version}</artifactId>
		</dependency>

What am I missing?

BR
Yanick

Additional information from curl:

curl -k -v https://localhost:9999 
* Rebuilt URL to: https://localhost:9999/ 
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 9999 (#0)
* ALPN, offering h2 
* ALPN, offering http/1.1
* successfully set certificate verify locations: 
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2): 
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
* TLSv1.2 (OUT), TLS change cipher, Client hello (1):
* TLSv1.2 (OUT), TLS handshake, Finished (20):
* TLSv1.2 (IN), TLS handshake, Finished (20): 
* SSL connection using TLSv1.2 / ECDHE-RSA-AES256-GCM-SHA384
* ALPN, server did not agree to a protocol

As you can see it says ALPN, offering h2 and then ALPN, server did not agree to a protocol

Figured out my problem. I was using:

Http.get(actorSystem).bind(...) and then on each incoming connection connection.handleAsync. It seems that this is not equivalent to Http.get(actorSystem).bindAndHandleAsync. I will check with akka http if this is intended.

This is not ‘intended’ per se, but it’s a known limitation that Akka HTTP HTTP/2 support currently only works with bindAndHandleAsync (https://doc.akka.io/docs/akka-http/current/server-side/http2.html#use-bindandhandleasync-and-https).