public / sonora

A gRPC-Web implementation for Python
Apache License 2.0
243 stars 13 forks source link

TypeError: expected bytes, bytearray found #58

Closed zykron1 closed 1 year ago

zykron1 commented 1 year ago

I am using uvicorn with sonora and am using the sonora.client API. Since these 2 datatype are almost the same I believe a simple edit to the code base would fix this. Full error log below:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uvicorn/protocols/http/h11_impl.py", line 429, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 78, in __call__
    return await self.app(scope, receive, send)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sonora/asgi.py", line 41, in __call__
    await self._do_grpc_request(rpc_method, context, receive, send)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sonora/asgi.py", line 115, in _do_grpc_request
    request_proto = await anext(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sonora/asgi.py", line 427, in anext
    return await anxt()
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/sonora/asgi.py", line 107, in <genexpr>
    rpc_method.request_deserializer(message)
TypeError: expected bytes, bytearray found
itsluketwist commented 1 year ago

Fixed via https://github.com/public/sonora/pull/59