Incorrect Status Code with invalid key in gRPC passthrough proxying with tyk

Hi, I have configured tyk as API gateway for gRPC passthrough proxy. The tyk and the downstream systems are all on k8s. I have configured “api_key”. The API keys are working fine.

The calls are like

grpcurl \
-H Authorization:<base_64_encoded_key> \
-d '{
  []
}' \
--insecure <tyk-gateway_uri>:443 <service>/<method>

However, when I pass an invalid “api_key”, the grpc returns Status Code: 13. with the error message

Error invoking method "<>/<method_name>": rpc error: code = Internal desc = failed to query for service descriptor "<service_name>": stream terminated by RST_STREAM with error code: PROTOCOL_ERROR

When I look at the pods logs I can see an entry

time="Mar 14 03:09:55" level=info msg="Attempted access with non-existent key." api_id=<> api_name="<>" key="****In0=" mw=AuthKey org_id=<> origin=<> path=/grpc.reflection.v1.ServerReflection/ServerReflectionInfo

I understand unlike HTTP the grpc error codes are different. However, if key validation fails it seems misleading to send Status Code of 13.

Is there any configuration I am missing or is this expected behaviour?

@sharathchandramg Thanks for posting this. I can confirm you aren’t missing any configuration. I can replicate the same behaviour. I have asked internally about this.

It may be the golang gRPC package we use that returns this when the stream is received with code 0.

I’ll reply as soon as I get an internal respond

I have created an internal bug request for this. The internal ID for reference is TT-11900. We’ll update this thread once we have an update.