Ee Chin
Ee Chin

Reputation: 21

Azure Durable functions python DurableOrchestrationContext get_input returning null

I am testing this function, get_input() from Azure durable functions for Orchestra function. More details of the function.

What I'm facing now is that, when I'm trying to test with postman and input a json input for e.g.

{
    "points": 222
}

as the json body and while calling for http://localhost:<portnumber>/api/orchestrators/DurableFunctionsOrchestrator1, it will always return me a null value when i try to return the get_input function's value

Below is a screenshot of what it returns me. As you can see everything is working fine since its completed status but the output always returns me a null.

enter image description here

Upvotes: 1

Views: 1301

Answers (1)

Delliganesh Sevanesan
Delliganesh Sevanesan

Reputation: 4776

In a Instance_id you can pass your Client_input over there to get the request body parameter off the Durable Orchestration Client. Pass a Json serialized payload over the orchestrator.

async  def  main(req: func.HttpRequest, starter: str) -> func.HttpResponse:

client =  df.DurableOrchestrationClient(starter)

function_name =  req.route_params["functionName"]

requestBody =  json.loads(req.get_body().decode())

instance_id =  await  client.start_new(function_name, client_input=requestBody)

In a orchestrator, the code you can use the same get_input():

requestBody : str  =  context.get_input()

I am tried with the blog. I am not getting any Null value on get_input().

Upvotes: 1

Related Questions