You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[WORKFLOW SDK BUG] raise_workflow_event drops falsy event data and the workflow receives None #1375
A workflow receives the event value that was sent with raise_workflow_event. Only data=None leaves the input unset.
Actual Behavior
DaprWorkflowClient.raise_workflow_event sends no payload when data is falsy. An event raised with data=False, data=0, data='', data=[] or data={} reaches the workflow as None. The async client in dapr.ext.workflow.aio does the same.
Approval workflows hit this directly. A reviewer who rejects a request with data=False produces None in the workflow, so a check like if approved is False takes the wrong branch. A count sent as 0 arrives as None, and arithmetic on it fails the workflow.
The cause is raise_orchestration_event_with_result in dapr/ext/workflow/_durabletask/client.py and dapr/ext/workflow/_durabletask/aio/client.py. Both build the request input with if data else None. schedule_new_orchestration_with_result and the rerun request in the same files test is not None, and so do WithEventPayload in durabletask-go and raiseEvent in durabletask-java.
The same truthiness check is in get_actions for events carried over by continue_as_new(save_events=True). I left that one alone, since #1374 edits get_actions.
Steps to Reproduce the Problem
from unittest.mock import MagicMock, patch
from dapr.ext.workflow._durabletask.client import TaskHubGrpcClient
with patch('dapr.ext.workflow._durabletask.internal.shared.get_grpc_channel'):
client = TaskHubGrpcClient()
client._stub = MagicMock()
client.raise_orchestration_event('instance1', 'approval', data=False)
request = client._stub.RaiseEvent.call_args[0][0]
print(request.HasField('input')) # prints False
I also sent data=False through DaprWorkflowClient to a fake sidecar on a local gRPC server and replayed the request into the orchestration executor. A workflow that returns the event value completed with {"received": null}.
Release Note
RELEASE NOTE: FIX raise_workflow_event delivers False, 0 and empty values to the workflow instead of None.
Activity