Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ScheduleNewOrchestrationInstanceAsync() is Not Scheduling an Orchestration #256

Open
tomseida opened this issue Dec 14, 2023 · 7 comments · May be fixed by Azure/azure-functions-durable-extension#2805
Labels
bug Something isn't working P1

Comments

@tomseida
Copy link
Contributor

tomseida commented Dec 14, 2023

Using StartOrchestrationOptions.StartAt property when calling ScheduleNewOrchestrationInstanceAsync() does not schedule an orchestration. Orchestrations always run immediately.

To replicate this issue, create a new Net 8.0 Azure Functions app in Visual Studio and, when prompted, select Function Durable Functions Orchestrations. Update all nuget pacakges. Alter the HttpStart method as follows:

    [Function("ScheduleWorkflow_HttpStart")]
    public static async Task<HttpResponseData> HttpStart(
        [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestData req,
        [DurableClient] DurableTaskClient client,
        FunctionContext executionContext)
    {
        ILogger logger = executionContext.GetLogger("ScheduleWorkflow_HttpStart");

        // Function input comes from the request content.
        DateTimeOffset startAt = DateTimeOffset.UtcNow.AddMinutes(10);

        string instanceId = await client.ScheduleNewOrchestrationInstanceAsync(
            nameof(Function1),
            new StartOrchestrationOptions { StartAt = startAt });

        logger.LogInformation("Orchestration with ID = '{instanceId}' to be started at {startAt}.", instanceId, startAt);

        // Returns an HTTP 202 response with an instance management payload.
        // See https://learn.microsoft.com/azure/azure-functions/durable/durable-functions-http-api#start-orchestration
        return client.CreateCheckStatusResponse(req, instanceId);
    }

The nuget pacakges are as follows:

  <ItemGroup>
    <PackageReference Include="Azure.Identity" Version="1.10.4" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.20.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.1.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Blobs" Version="6.2.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.16.4" />
    <PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.22.0" />
    <PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="1.1.0" />
  </ItemGroup>

The orchestration will run immediately. It should run 10 minutes from making the HTTP request.

This issue was discovered in one of our real function applications. When running that app locally, we looked into the storage emulator (Azurite) and could see that the ScheduleStartTime is not being set.

If we downgrade "Microsoft.Azure.Functions.Worker.Extensions.DurableTask" to version "1.0.0" the schedule feature works.

    <PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.DurableTask" Version="1.0.0" />
@lilyjma lilyjma added the Reliability Durable functions get stuck or don’t run as expected. label Jan 4, 2024
@lilyjma lilyjma added P2 and removed P1 labels Jan 30, 2024
@ChristopherL-STCU
Copy link

I'm experiencing the same issue with v1.1.1. It appears the StartAt issue was introduced between v1.0.3 and v1.0.4 of Microsoft.Azure.Functions.Worker.Extensions.DurableTask.

I need to use v1.1.1 because it contains async versions of methods, such as CreateCheckStatusResponseAsync, which is needed due to this change and which Durable Functions was updated for here. So I'm stuck.

@cgillum cgillum added bug Something isn't working and removed Reliability Durable functions get stuck or don’t run as expected. labels Mar 12, 2024
@cgillum
Copy link
Member

cgillum commented Mar 12, 2024

This looks like a regression caused by #2634. When the code was refactored, the scheduled time information was no longer being propagated to the messaging layer. /cc @jviau

@RobARichardson
Copy link

Just stumbled on this issue because I was observing the same behavior. A fix would be much appreciated.

@RobARichardson
Copy link

Sorry to nag, but any update on this? Would really like to be able to use this feature.

@developmentvegas
Copy link

I am using Microsoft.Azure.Functions.Worker.Extensions.DurableTask v1.4, and I am still having this issue. Is there any idea when this will be solved? This has been in P1 for a while without resolution.

@tomseida
Copy link
Contributor Author

tomseida commented Sep 24, 2024

It has been over nine months since this ticket was created noting that ScheduleNewOrchestrationInstanceAsync() is unable to Schedule an orchestration. It makes me wonder if Microsoft is committed to supporting function apps since it is letting this obvious defect linger for so long. Please give the community an update or release the fix!

@cgillum
Copy link
Member

cgillum commented Sep 24, 2024

Please use Azure/azure-functions-durable-extension#2805 to follow the latest status of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working P1
Projects
None yet
7 participants