grpc / grpc-swift

The Swift language implementation of gRPC.
Apache License 2.0
2.04k stars 420 forks source link

grpc: received message larger than max (9014796 vs. 4194304) #1517

Open Amit011121 opened 2 years ago

Amit011121 commented 2 years ago

Help me with this grpc: received message larger than max (9014796 vs. 4194304).

-- which property should i use to set the (X 1024 1024) message size.

glbrntt commented 2 years ago

The error message for this type of error is different in grpc-swift, it looks like it comes from http://github.com/grpc/grpc. The option should be something like 'maxReceiveMessageLength'.

Amit011121 commented 2 years ago

Hey glbrntt thanks for the quick reply there is no such maxReceiveMessageLength property in grpc-swift.

glbrntt commented 2 years ago

This error doesn't come from grpc-swift. It looks like it comes from http://github.com/grpc/grpc.

I suspect the server is throwing this error and sending it back as the status to the client which is where you are seeing it. This needs configuring on the server, not the client.

Amit011121 commented 2 years ago

Hi

We found that there is one property available in Objective C i.e #define GRPC_ARG_MAX_RECEIVE_MESSAGE_LENGTH "grpc.max_receive_message_length" but I am not able to use it in the Swift. I tried searching it in the pod but this property is not defined. As per the docs available we found that this property needs to be set when we are creating the channel request, but at my side I am not able to access that property. Can you please let me know what needs to be done here.

How can we manage this at client side?

glbrntt commented 2 years ago

I'll try to be as clear as I can here:

grpc: received message larger than max (9014796 vs. 4194304).

As previously stated the error comes from grpc/grpc.


If you are using this library as a client and seeing this error then it can only come from the status which is sent by the server at the end of every RPC.

This means the server is complaining about the message being too large. Therefore the client has sent a message which is too large for the server to receive.

To resolve this you have two options:

  1. Send smaller messages from the client.
  2. Configure the server (if you manage it) to allow larger messages to be received.