Open nickholt15 opened 10 months ago
@nickholt15 Hey, I think I experienced the same problem: https://github.com/Azure/azure-functions-durable-python/issues/478 you might want to have a look for details.
I am a little afraid to mark mine as a duplicate of yours, since I guess MS will then discard mine and will not have a look at the details (which as I think are really helpful). So I ask you, if you might want to tag yours as a duplicate of mine?
I just ran into this issue and am grateful you'd reported it with the explanation of what's happening.
🐛 Describe the bug
There is a logical error in the
DurableOrchestrationContext
call_http
method.https://github.com/Azure/azure-functions-durable-python/blob/dev/azure/durable_functions/models/DurableOrchestrationContext.py#L215
content
is type hinted as astr
, however it only works with dictionary input.I noticed this error when turning on type checking within VS Code.
To satisfy the type checker, I tried piping the dictionary object through
json.dumps()
, but that led to an error during execution.🤔 Expected behavior This should work with either dictionary or string input. It only works with dictionary input.
☕ Steps to reproduce Construct an arbitrary
payload
with key-value pairs.context.call_http(method='POST', content=payload, uri=my_uri)
succeedscontext.call_http(method='POST', content=json.dumps(payload), uri=my_uri)
failsLine 239 is responsible for the error: https://github.com/Azure/azure-functions-durable-python/blob/dev/azure/durable_functions/models/DurableOrchestrationContext.py#L239
The line:
if content and content is not isinstance(content, str):
should instead be:
if content and not isinstance(content, str):