[Bug]: There seems to be no way to set the success code for gRPC services
Description:
I have a backend gRPC service that I'm attempting to set the health check success code with an http configuration as follows:
http:
version: grpc
path: /
healthcheck:
path: "/grpc.health.v1.Health/Check"
success_codes: "0"
I get the following error:
- Updating the infrastructure for ... [update rollback complete] [10.5s]
The following resource(s) failed to update: [TargetGroup].
- A target group to connect the load balancer to your service on port 8080 [update complete] [0.0s]
Resource handler returned message: "Health check matcher GRPC code can
not be empty (Service: ElasticLoadBalancingV2, Status Code: 400, Reque
st ID: 2f882cda-c03f-4a13-90fd-de57293579b7)" (RequestToken: 6e68ba66-
1ac0-9126-8914-6128326c07f0, HandlerErrorCode: GeneralServiceException
)
If I don't set the success_codes, AWS uses its default value of 12 which causes my health checks to fail.
Details:
AWS Region: us-east-2 type: Backend Service version: version: v1.34.0, built for darwin
Observed result:
Error when attempting to set the success code.
Expected result:
Target group health check is configured with the success code set to zero rather than 12.
Debugging:
I checked the source code and this file https://github.com/aws/copilot-cli/blob/b1c4c42cf1c47793a8181314a732312f3e3df1a7/internal/pkg/template/templates/workloads/partials/cf/alb.yml#L43 seems to imply that it should be set using the http.additional_rules but when I tried that as in the following:
http:
version: grpc
path: /
additional_rules:
- healthcheck:
path: "/grpc.health.v1.Health/Check"
success_codes: "0"
I get the following error:
✘ validate manifest against environment "staging": validate "http": validate "additional_rules[0]": "path" must be specified
Did you manage to sort a way out of this?
Yes, I used the override capability (cfn.patches.yml) for my service to set it to 0 as in the following:
- op: add
path: /Resources/TargetGroup/Properties/Matcher
value:
GrpcCode: 0