-
Hi all, I started to work with Durable Function to solve an issue with timeout..
I'm getting this after make a call to my function which I think is defined as the examples. program.cs var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults(worker =>
{
new DurableTaskExtensionStartup().Configure(worker);
worker.UseMiddleware<LoggingMiddleware>();
}) function: public class DurableTransactionFunction
{
private readonly DurableTaskClient _durableTaskClient;
private readonly ILogger _logger;
public DurableTransactionFunction(DurableTaskClient durableTaskClient, ILoggerFactory loggerFactory)
{
_durableTaskClient = durableTaskClient;
_logger = loggerFactory.CreateLogger<DurableTransactionFunction>();
}
[Function("GetTransactionByTypeToDataLake_HttpStart")]
public async Task<HttpResponseData> HttpStart(
[HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req,
FunctionContext executionContext)
{
ProcessDataParamsInputDto<GetTransactionByTypeToDataLakeParamsInputDto> processInputParams = ProcessDataParamsInputDto<GetTransactionByTypeToDataLakeParamsInputDto>.GetFromHttpRequest(req);
string instanceId = await _durableTaskClient.ScheduleNewOrchestrationInstanceAsync("GetTransactionByTypeToDataLakeOrchestrator", processInputParams);
HttpResponseData response = req.CreateResponse(HttpStatusCode.OK);
await response.WriteStringAsync($"Orchestration started with ID: {instanceId}");
return response;
}
} Btw those are the references packages that my project has: <ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.22.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.17.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.0" />
</ItemGroup> Any idea what is going on? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
(I updated your post to fix the formatting and make it more readable) It would be good if you could share your orchestrator function code since that's where the error is essentially coming from. Aside from the missing code, the thing that looks odd to me is your Program.cs. Specifically, this line: new DurableTaskExtensionStartup().Configure(worker); Can you tell us a bit more about why you added this line? It shouldn't be needed AFAIK. |
Beta Was this translation helpful? Give feedback.
-
I think you can ignore my other response. I misread the error message. The problem you're encountering is that [Function("GetTransactionByTypeToDataLake_HttpStart")]
public async Task<HttpResponseData> HttpStart(
[HttpTrigger(AuthorizationLevel.Function, "post")] HttpRequestData req,
[DurableClient] DurableTaskClient durableClient,
FunctionContext executionContext)
{
ProcessDataParamsInputDto<GetTransactionByTypeToDataLakeParamsInputDto> processInputParams =
ProcessDataParamsInputDto<GetTransactionByTypeToDataLakeParamsInputDto>.GetFromHttpRequest(req);
string instanceId = await durableClient.ScheduleNewOrchestrationInstanceAsync(
"GetTransactionByTypeToDataLakeOrchestrator",
processInputParams);
HttpResponseData response = req.CreateResponse(HttpStatusCode.OK);
await response.WriteStringAsync($"Orchestration started with ID: {instanceId}");
return response;
} |
Beta Was this translation helpful? Give feedback.
I think you can ignore my other response. I misread the error message. The problem you're encountering is that
DurableTaskClient
must be added as a parameter to your HTTP trigger function with a[DurableClient]
attribute binding instead of as a constructor for your class. Something like this: