gRPC example does not work


Trying out Fly for the first time and attempting to deploy my gRPC server to Fly.

The simple Fly gRPC example here no longer works.

I followed the instructions and noticed the following items that are out of date:

  • flyctl init command no longer exists.
  • runs a curl command that fails (and doesn’t make much sense)

The service deploys successfully but does not respond to any requests. The example grpcurl command fails, with one of several errors:

% grpcurl -proto hello.proto MainService/Hello
Failed to dial target host "": remote error: tls: no application protocol
% grpcurl -proto hello.proto MainService/Hello
Failed to dial target host "": read tcp> read: connection reset by peer
% grpcurl -proto hello.proto MainService/Hello
Failed to dial target host "": remote error: tls: no application protocol

Status and logs are pretty unremarkable:

% flyctl logs                                                           
2022-02-09T06:30:04Z runner[09933354] dfw [info]Starting instance
2022-02-09T06:30:05Z runner[09933354] dfw [info]Configuring virtual machine
2022-02-09T06:30:05Z runner[09933354] dfw [info]Pulling container image
2022-02-09T06:30:06Z runner[09933354] dfw [info]Unpacking image
2022-02-09T06:30:09Z runner[09933354] dfw [info]Preparing kernel init
2022-02-09T06:30:09Z runner[09933354] dfw [info]Configuring firecracker
2022-02-09T06:30:09Z runner[09933354] dfw [info]Starting virtual machine
2022-02-09T06:30:09Z app[09933354] dfw [info]Starting init (commit: 0c50bff)...
2022-02-09T06:30:09Z app[09933354] dfw [info]Preparing to run: `/cnb/process/web` as 1000
2022-02-09T06:30:09Z app[09933354] dfw [info]2022/02/09 06:30:09 listening on [fdaa:0:4bb1:a7b:7b:993:3354:2]:22 (DNS: [fdaa::3]:53)
2022-02-09T06:30:09Z runner[09933354] dfw [info]Virtual machine started successfully

% flyctl status
  Name     = quiet-sun-812          
  Owner    = personal               
  Version  = 0                      
  Status   = running                
  Hostname =  

Deployment Status
  ID          = 9cd16dbd-09c3-b126-7ddb-b7167fdcd4df         
  Version     = v0                                           
  Status      = successful                                   
  Description = Deployment completed successfully            
  Instances   = 1 desired, 1 placed, 1 healthy, 0 unhealthy  

09933354	app    	0      	dfw   	run    	running	1 total, 1 passing	0       	11m52s ago	

My gRPC server is also in Go and fails in the same way.

This looks like the same or similar issue reported in Oct 2021 here. That’s a long time for this to be broken with no response. It makes me a bit nervous about using Fly.

Any help? What’s going on?


Hey! Thanks for bringing this up. I updated the example. Here’s the key thing you need to make this work in fly.toml:

  alpn = ["h2"]

Hey Joshua. Thanks! Adding the tls_options parameter fixed it.

You might want to double check the changes to the fly-apps/grpc-service repo though. Looks like you removed the fly.template.toml entirely. Following the steps in Deploying the gRPC service to Fly does not result in a working application.

It seems like there are a lot of directives for fly.toml that aren’t documented (like tls_options). Am I missing something? Is there complete documentation somewhere?

Oops, you’re right. We’ll get that repo fixed. We’re working on bringing our docs up to date too. Thanks for bringing it up!