gRPC Max Msg size limit hit


#1

Hi,

We’re using TYK GW CE 2.7.4. It appears in this version, the grpc message size limit is set to the default value at 4MB.

Is it possible to configure TYK GW to up this limit? If so, how?

We’re getting the following from tyk-gateway error log:

time=“Apr 10 05:04:45” level=error msg=“rpc error: code = 8 desc = grpc: received message larger than max (5097416 vs. 4194304)”

time=“Apr 10 05:04:45” level=error msg=“Dispatch error” error=“rpc error: code = 8 desc = grpc: received message larger than max (5097416 vs. 4194304)”


#2

Hi Jeffrey, I’m investigating this issue.

Will keep you updated.

Regards.


#3

@matiasb Thanks for the prompt response!


#4

@matiasb One follow up question:
we want to capture this condition (payload exceed size limit) and provide a more user-friendly error message in the API response. Any suggestion on how can we do that w/o incurring extra API response time?


#5

I’ve created a patch that makes this parameter configurable, we’ll test it a bit and keep you updated about its availability.

About payload exceeding size limit, could you check the HTTP request body length or it your use case requires it to be integrated with gRPC in some other way?

Regards.


#6

Thanks for the quick turn-around.

  • Is there an installable patch for ver 2.7.4 which we’re using?
  • Is there a plan to back port the fix into existing releases (e.g. 2.7) or will it only be in the up-coming release?

Thanks for the tip about checking the size. I think we could check the request body length.


#7

I’m having some issue with the logic to check msg size.

Currently, I have a working API with a “Pre” hook attached to it to do some validation. I added this new logic to check for message size there but it looks like for this case, the “Dispatch error” happens before the “Pre” hook gets executed.

Any ideas where to insert this new check for msg size?
Thanks!


#8

BTW, I filed this new bug: https://github.com/TykTechnologies/tyk/issues/2208
It’s different from https://github.com/TykTechnologies/tyk/issues/2203