AttributeError In serve.deployment due to Starlette change

How severe does this issue affect your experience of using Ray?

  • Medium: It contributes to significant difficulty to complete my task, but I can work around it.

When I was going through the example deployment here, I encountered the following error:

(ProxyActor pid=72777) Exception raised in creation task: The actor died because of an error raised in its creation task, ray::SERVE_CONTROLLER_ACTOR:SERVE_PROXY_ACTOR-ad75394cb4890da5d959354be7dbb3b11222d6a38aee9a4a7e4cbc17:ProxyActor.__init__() (pid=72777, ip=127.0.0.1, actor_id=e32e002ebd1165433748a33501000000, repr=<ray.serve._private.proxy.ProxyActor object at 0x117b33af0>)
(ProxyActor pid=72777)   File "/Users/stuartjaffe/miniforge3/envs/ray_mlflow/lib/python3.9/concurrent/futures/_base.py", line 446, in result
(ProxyActor pid=72777)     return self.__get_result()
(ProxyActor pid=72777)   File "/Users/stuartjaffe/miniforge3/envs/ray_mlflow/lib/python3.9/concurrent/futures/_base.py", line 391, in __get_result
(ProxyActor pid=72777)     raise self._exception
(ProxyActor pid=72777)   File "/Users/stuartjaffe/miniforge3/envs/ray_mlflow/lib/python3.9/site-packages/ray/serve/_private/proxy.py", line 1202, in __init__
(ProxyActor pid=72777)     self.wrapped_http_proxy, **middleware.options
(ProxyActor pid=72777) AttributeError: 'Middleware' object has no attribute 'options'

This occurred on a M1 Mac (via miniforge) and on a AWS Linux EC2 instance. I figured it was an issue with Starlette and downgraded to Starlette v0.34.0 and the issue went away. Could you look into this bug? It seems that with Starlette v0.35.0 there was an update to the Middleware that is causing the issue. Thanks!

1 Like

Hi @goldenbear10 , we will fix the starlette issue in ray 2.10. Thank you for raising the issue!

When will 2.10 be released?

In the meantime, what’s a good way to fix this issue? thank you

1 Like

Getting this same issue just today. is there any way to fix the option error ?
AttributeError: ‘Middleware’ object has no attribute ‘options’

Hi folks, this will be fixed in an upcoming 2.9.2 release. In the meantime you can downgrade starlette and things should work as expected: pip install "starlette<=0.34.0".

2 Likes

Great to hear, waiting for 2.10 would have been a wee bit heavy-handed :wink:

Thank you!