I am building gRPC server with Ruby and trying to request it from Ruby Client through AWS ALB. We deploy it to AWS ECS on Fargate
problem
When I try to send requrest throgh ALB, I got the error below
GRPC::Unavailable (14:failed to connect to all addresses; last error: INTERNAL:
ipv4:myip:50051: Trying to connect an http1.x server.
debug_error_string:{UNKNOWN:failed to connect to all addresses; last error: INTERNAL:
ipv4:myip:50051: Trying to connect an http1.x server {grpc_status:14,
created_time:"2023-08-04T19:03:50.762448829+09:00"}}):
[6edb224a-1729-49ae-aa15-d396e4e04366]
GRPC::Unavailable (14:failed to connect to all addresses; last error:
INTERNAL: ipv4:myip:50051:
Trying to connect an http1.x server.
debug_error_string:{UNKNOWN:failed to connect to all addresses;
last error: INTERNAL: ipv4:myip:50051:
Trying to connect an http1.x server
{grpc_status:14, created_time:"2023-08-04T19:03:50.762448829+09:00"}}):
I use CDK to build Cloud and the code is like this
const alb = new ApplicationLoadBalancer(scope, 'alb', {
internetFacing: true,
http2Enabled: true,
loadBalancerName: `alb`,
securityGroup: this.sgGroups[0],
vpcSubnets: {
subnets: this.subnets,
},
vpc: this.vpc,
})
const tg = new ApplicationTargetGroup(scope, 'a', {
protocol: ApplicationProtocol.HTTP,
protocolVersion: ApplicationProtocolVersion.GRPC,
port: 50051,
targetType: TargetType.IP,
vpc: this.vpc,
healthCheck: {
healthyGrpcCodes: '0-99',
port: '8080',
path: '/grpc.health.v1.Health/Check',
protocol: Protocol.HTTP,
},
})
new ApplicationListener(scope, 'b', {
loadBalancer: alb,
protocol: ApplicationProtocol.HTTPS,
port: 50051,
certificates: [
{
certificateArn: certificate.certificateArn,
},
],
defaultTargetGroups: [tg],
})
What I confirmed
- gRPC server works fine becaseuse I got resepose when I attached domain to Fargate Task public IP without ALB and request it with ruby client.
- ALB Health Check status is healthy
- I checked security group, and it looks fine. they allow 50051 and 8080 request from anywhere.
- I found similar problem on StackOverflow url, but it doesnt work for me.
I will be very happy if someone has know something and let me know.