# gRPC example does not work

**URL:** <https://community.fly.io/t/grpc-example-does-not-work/4012>\
**Category:** Questions / Help\
**Created:** [February 9, 2022, 6:44am UTC](https://community.fly.io/t/grpc-example-does-not-work/4012 "2022-02-09T06:44:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sam\_Bobb](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/sam_bobb/32/7112_2.png) [@Sam\_Bobb](https://community.fly.io/u/Sam_Bobb)\
**Post date:** [February 9, 2022, 6:44am UTC](https://community.fly.io/t/grpc-example-does-not-work/4012/1 "2022-02-09T06:44:30Z")

</div>

Hi,

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

The simple [Fly gRPC example here](https://github.com/fly-apps/grpc-service) no longer works.

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

- `flyctl init` command no longer exists.
- `import_fly_template.sh ` 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:

```auto
% grpcurl -proto hello.proto quiet-sun-812.fly.dev:443 MainService/Hello
Failed to dial target host "quiet-sun-812.fly.dev:443": remote error: tls: no application protocol
% grpcurl -proto hello.proto quiet-sun-812.fly.dev:443 MainService/Hello
Failed to dial target host "quiet-sun-812.fly.dev:443": read tcp 192.168.1.81:55834->109.105.219.190:443: read: connection reset by peer
% grpcurl -proto hello.proto quiet-sun-812.fly.dev:443 MainService/Hello
Failed to dial target host "quiet-sun-812.fly.dev:443": remote error: tls: no application protocol

```

Status and logs are pretty unremarkable:

```auto
% 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
App
  Name = quiet-sun-812          
  Owner = personal               
  Version = 0                      
  Status = running                
  Hostname = quiet-sun-812.fly.dev  

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  

Instances
ID PROCESS	VERSION	REGION	DESIRED	STATUS HEALTH CHECKS RESTARTS	CREATED    
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](https://community.fly.io/t/urgent-grpc-server-unreachable-via-grpcurl/2694). 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?

Thanks!

---

<div class="post-metadata">

**Author:** ![jsierles](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jsierles/32/595_2.png) [@jsierles](https://community.fly.io/u/jsierles)\
**Post date:** [February 9, 2022, 11:11am UTC](https://community.fly.io/t/grpc-example-does-not-work/4012/2 "2022-02-09T11:11:32Z")

</div>

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

```auto
[services.ports.tls_options]
  alpn = ["h2"]

```

---

<div class="post-metadata">

**Author:** ![Sam\_Bobb](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/sam_bobb/32/7112_2.png) [@Sam\_Bobb](https://community.fly.io/u/Sam_Bobb)\
**Post date:** [February 9, 2022, 4:50pm UTC](https://community.fly.io/t/grpc-example-does-not-work/4012/3 "2022-02-09T16:50:20Z")

</div>

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](https://github.com/fly-apps/grpc-service/blob/0dbc4810bb1486a25f91a658d8b84087154405b1/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?

---

<div class="post-metadata">

**Author:** ![jsierles](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jsierles/32/595_2.png) [@jsierles](https://community.fly.io/u/jsierles)\
**Post date:** [February 12, 2022, 4:02pm UTC](https://community.fly.io/t/grpc-example-does-not-work/4012/4 "2022-02-12T16:02:03Z")

</div>

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!
