Closed evanlouie closed 11 months ago
probably related: https://github.com/Azure/azure-functions-durable-python/issues/260
Hi @evanlouie, thanks for reaching out and thanks for the detailed bug report.
As per the docs, activiies do not need to return a value.
You're correct, that's a documentation bug. I'm noting that down as a follow up item.
azure-functions-durable is expecting the Result of tasks to ALWAYS be a JSON serializeable string so it can json.loads(...) it (see TaskOrchestrationExecutor).
Yes, that's correct, there's an assumption that inputs and outputs can be JSON serialized.
The Result property for events in table storage is a string. But when an activty returns None, instead of storing "null" in the row, it saves nothing.
Just to confirm, are you actually triggering a bug where you receive a None
result and the result isn't properly assigned to a task? To my understanding, since activities are failing at the point of returning None
, then the error is occuring before we even attempt to set a task's output value, right?
Hi @davidmrdavid
Just to confirm, are you actually triggering a bug where you receive a None result and the result isn't properly assigned to a task? To my understanding, since activities are failing at the point of returning None, then the error is occuring before we even attempt to set a task's output value, right?
The activities which return None
actually complete successfully. If I look the storage account in the History
table (i.e TestHubNameHistory
on local azurite), the activities which return None
will have EventType
== TaskCompleted
with Result
== null
.
then the error is occuring before we even attempt to set a task's output value, right?
So from the looks of it, the durable functions runtime allow activities to return None (and is stored as null
in table), but the TaskOrchestrationExecutor
which the orchestrator calls does not deserialize the null
as it expects a JSON string.
@davidmrdavid @lilyjma I recently root caused another customer issue to this bug. It would be great if we could prioritize fixing it, as it seems like a trivially simple issue that is really hard to debug.
Close the issue as the PR is merged.
(Unpinning issue since it's fixed.)
🐛 Describe the bug
Activities cannot return
None
.If an activity returns
None
, the following exception is raised when the orchestrator attempts to parse the returned value.:🤔 Expected behavior
As per the docs, activiies do not need to return a value.
☕ Steps to reproduce
Then call the orchestrator:
Other Notes
Their seems to be a misalignment between the durable functions runtime and the
azure-functions-durable
library:azure-functions-durable
is expecting theResult
of tasks to ALWAYS be a JSON serializeable string so it canjson.loads(...)
it (seeTaskOrchestrationExecutor
).Result
property for events in table storage is a string. But when an activty returnsNone
, instead of storing"null"
in the row, it saves nothing.Either
azure-functions-durable
needs to check forNone
before doingjson.loads(...)
inTaskOrchestrationExecutor.set_task_value
or the durable functions runtime needs to start emitting"null"
for null result values.