-
Notifications
You must be signed in to change notification settings - Fork 135
Open
Labels
kind/bugSomething isn't workingSomething isn't working
Description
Expected Behavior
When using the CallableProxy, I expect args and kwargs to work, so I expect this to work:
class DemoActorInterface(ActorInterface):
@actormethod(name="GetMyData")
async def get_my_data(self, test: str) -> object:
...
# Create proxy client
proxy = ActorProxy.create('DemoActor', ActorId('1'), DemoActorInterface)
# Call method on client
resp = await proxy.GetMyData("my-string")
resp = await proxy.GetMyData(test="my-string")
Actual Behavior
Only the first call works, because the string is passed as arg,
the second will send an empty payload, because it is a kwargs.
This is the CallableProxy code:
https://github.com/dapr/python-sdk/blob/147f1c4ffc0a43887c63f592011414aa5a130dea/dapr/actor/client/proxy.py#L81C1-L94C98
async def __call__(self, *args, **kwargs) -> Any:
if len(args) > 1:
raise ValueError('does not support multiple arguments')
bytes_data = None
if len(args) > 0:
if isinstance(args[0], bytes):
bytes_data = args[0]
else:
bytes_data = self._message_serializer.serialize(args[0])
rtnval = await self._proxy.invoke_method(self._attr_call_type['actor_method'], bytes_data)
This completely ignores arguments passed as kwargs
Steps to Reproduce the Problem
Use the demo, require a parameter, call the proxy as shown above.
The first gets the string, the second will not.
Release Note
RELEASE NOTE: FIX CallableProxy now accepts kwargs next to args
Metadata
Metadata
Assignees
Labels
kind/bugSomething isn't workingSomething isn't working