Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1367

Akka gRPC/HTTP Interop giving 404

$
0
0

Hello, I have an application running a gRPC service alongside a simple Akka HTTP endpoint. I am following this guide: Akka HTTP interop • Akka gRPC. The problem: when curling the HTTP endpoint I get 404 not found. I know it found the server because Akka-HTTP/10.2.5 is the server of the response header.

Some code:

object Server extends App {
        val conf = ConfigFactory
            .parseString("akka.http.server.preview.enable-http2 = on")
            .withFallback(ConfigFactory.defaultApplication())
        val system = ActorSystem("Interop", conf)
        new Server(system).run()
}

class Server(system: ActorSystem) {
    def run() = {
        // implicit sys, ec...
        val grpcService: HttpRequest => Future[HttpResponse] = ServiceHandler(new Service())
        val greeter = get {
            pathEndOrSingleSlash {
                complete("I am alive")
            }
        }
        // lifted this line straight out of the guide
        val grpcRoute = { ctx => grpcService(ctx.request).map(RouteResult.Complete) }
        val route = concat(greeter, grpcRoute)
        val binding = Http().newServerAt("127.0.0.1", 8080).bind(route)
        binding
    }
}

When I take out the gRPC route, the greeter endpoint works as intended. Otherwise, when I curl http://localhost:8080, I get

*Mark bundle as not supporting multiuser
<HTTP/1.1 404 Not Found
<Server: akka-http/10.2.5
<other-stuff

I am using akka-gRPC 2.0.0

What should I do to ensure interop between the two routes?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 1367

Trending Articles