iazaran/php-mvc

gRPC not working

Opened this issue · 0 comments

Describe the bug
Unknown issue on gRPC response

To Reproduce
Steps to reproduce the behavior:

  1. Start docker-compose up -d that include requirements for gRPC
  2. Making sure that .proto is updated and PHP classes generated by
docker-compose exec php-mvc-app protoc -I=src/Controllers/API \
    src/Controllers/API/blog.proto \
    --php_out=src/Controllers/API/gRPC \
    --grpc_out=src/Controllers/API/gRPC \
    --plugin=protoc-gen-grpc=/usr/bin/grpc_php_plugin
  1. There is an example route to Show method in grpc/index.php. Now run grpcurl -v -plaintext -d '{"slug": "an-example"}' -proto ./src/Controllers/API/blog.proto localhost:8585 blog.Blog/Show

Expected behavior
Something like

{"id": 1, "slug": "an-example", ... "updated_at": "2022-02-14 00:00:00"}

But I receive:

Resolved method descriptor:
// READ one
rpc Show ( .blog.PostRequest ) returns ( .blog.PostResponse );

Request metadata to send:
(empty)

Response headers received:
content-type: application/grpc+proto
date: Sun, 13 Feb 2022 22:31:07 GMT
server: nginx/1.21.3
x-powered-by: PHP/8.1.1

Response trailers received:
(empty)
Sent 1 request and received 0 responses
ERROR:
  Code: ResourceExhausted
  Message: grpc: received message larger than max (808722512 vs. 4194304)

Even after including grpc.max_receive_message_length on client class. Also testing by PostMan and Kreya shows the 13 Internal error and 'Failed to deserialize response message'