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
I first posted this Issue on stackoverflowhere and @cgillum kindly answered and asked me to post here. I will though add that question here as well.
So I'm prototyping some Azure Durable Functions, to try and understand to see if they will fit within a proposed solution for our internal API system.
Based on examples, I've created a Orchestrator Client (HelloOrchestratorClient.cs), that responds to a HttpTrigger. This client extracts some information from the original request, then proceeds to fire off a Orchestrator Function (HelloOrchestrator.cs) passing in some of the information extracted:
The HelloOrchestrator.cs simply for now is just calling off to one of our internal API's and returning a JsonProduct payload (Simple POCO describing, you guessed it, a title), using a ActivityTigger named HelloOrchestrator.APICall to make the API call itself.
Side Note: The plan is if I can get this to work, is to fan out a bunch of processes to different API's and fan back in again and merge the JSON payload and return it back to the originator.
Issue I'm experiencing
So, when my List<JsonProduct> is returned back from HelloOrchestrator.Run, I receive the following NullReferenceException found on this Gist (Big stack trace) and I receive a 500 response from the Orchestrator Client.
The following proves the output returned does actually have an object at runtime:
Could it be due to the complexity of JsonProduct (Again find the model classes here)? I ask, because when I swap out my Orchestrator Function for a simpler model structure, I don't receive a 500, I receive my JSON Payload.
This example shows the Simple Orchestrator FunctionHelloOrchestrator.cs, returning a simple TestToDo (Gist for model) flat object that doesn't error:
Simple HelloOrchestrator.cs:
[FunctionName("E1_Todo")]publicstaticasyncTask<TestToDo>RunToDo([OrchestrationTrigger]DurableOrchestrationContextBasecontext,ILoggerlog){HttpReqr=context.GetInput<HttpReq>();TestToDotodo=newTestToDo();if(r!=null){todo=awaitcontext.CallActivityAsync<TestToDo>("E1_CallAPITodo",r);}returntodo;}[FunctionName("E1_CallAPITodo")]publicasyncstaticTask<TestToDo>APITodoCall([ActivityTrigger]HttpReqreq,ILoggerlog){varrequest=newHttpRequestMessage(HttpMethod.Get,"https://jsonplaceholder.typicode.com/todos/1");request.Headers.Accept.Add(newMediaTypeWithQualityHeaderValue("application/json"));log.LogInformation($"URL calling = '{request.RequestUri.AbsoluteUri}'. for {req.QueryString}");HttpResponseMessageresponse=awaitclient.SendAsync(request);returnawaitresponse.Content.ReadAsAsync<TestToDo>();
More Information
If you require my full prototype projects, you can find them here:
Interesting (Question that @cgillum asked in the SO post, was the error could be due to an QueryString encoding. So I tested again using the following and it worked, so it seems @cgillum could be right:
I first posted this Issue on stackoverflow here and @cgillum kindly answered and asked me to post here. I will though add that question here as well.
So I'm prototyping some Azure Durable Functions, to try and understand to see if they will fit within a proposed solution for our internal API system.
Based on examples, I've created a Orchestrator Client (
HelloOrchestratorClient.cs
), that responds to aHttpTrigger
. This client extracts some information from the original request, then proceeds to fire off a Orchestrator Function (HelloOrchestrator.cs
) passing in some of the information extracted:Complex HelloOrchestratorClient.cs:
The
HelloOrchestrator.cs
simply for now is just calling off to one of our internal API's and returning aJsonProduct
payload (Simple POCO describing, you guessed it, a title), using aActivityTigger
namedHelloOrchestrator.APICall
to make the API call itself.Complex HelloOrchestrator.cs:
Side Note: The plan is if I can get this to work, is to fan out a bunch of processes to different API's and fan back in again and merge the JSON payload and return it back to the originator.
Issue I'm experiencing
So, when my
List<JsonProduct>
is returned back fromHelloOrchestrator.Run
, I receive the followingNullReferenceException
found on this Gist (Big stack trace) and I receive a 500 response from the Orchestrator Client.The following proves the output returned does actually have an object at runtime:
Could it be due to the complexity of
JsonProduct
(Again find the model classes here)? I ask, because when I swap out my Orchestrator Function for a simpler model structure, I don't receive a 500, I receive my JSON Payload.This example shows the Simple Orchestrator Function
HelloOrchestrator.cs
, returning a simpleTestToDo
(Gist for model) flat object that doesn't error:Simple HelloOrchestrator.cs:
More Information
If you require my full prototype projects, you can find them here:
When you run it, use the following in something like Postman (After F5ing it):
Interesting (Question that @cgillum asked in the SO post, was the error could be due to an QueryString encoding. So I tested again using the following and it worked, so it seems @cgillum could be right:
FYI: Both W&N and WANDN are valid values for our filterByImprints parameter.
When you run it, use the following in something like Postman (after F5ing it):
The text was updated successfully, but these errors were encountered: