Skip to content

DurableOrchestrationStatus constructor sets this.history with init.history instead of init.historyEvents #620

@JPF3N998

Description

@JPF3N998

Describe the bug

When calling durableClient.getStatus(<instanceId>, { showHistory: true }), history is not returned on response. While debugging, DurableOrchestarationStatus's constructor does:

// init.history does not exist on init but historyEvents does and contains the history data
this.history = init.history

Investigative information

  • Durable Functions extension version: 1.16.1
  • durable-functions npm module version: 3.1.0
  • Language (JavaScript/TypeScript) and version: typescript 4.9.5
  • Node.js version: 20.17.0

Additional:

  • Azure Functions Core Tools: 4.0.5801
  • Azure Runtime Version: 4.34.1.22669

If deployed to Azure App Service

  • Timeframe issue observed: N/A
  • Function App name: N/A
  • Function name(s): N/A
  • Region: N/A
  • Orchestration instance ID(s): N/A

If you don't want to share your Function App name or Functions names on GitHub, please be sure to provide your Invocation ID, Timestamp, and Region - we can use this to look up your Function App/Function. Provide an invocation id per Function. See the Functions Host wiki for more details.

To Reproduce

  1. VSCode + Function App VSCode extension + Azurite (Official setup docs)
  2. F1 > Azure Functions: Create Function > Durable Functions orchestrator > Give it a name (Ex: "Test")
  3. Orchestrator code should be Microsoft's example boilerplate code. The output of the durable function orchestration should be:
{
    "name": "helloOrchestrator",
    "instanceId": "6ba3f77933b1461ea1a3828c013c9d56",
    "runtimeStatus": "Completed",
    "input": "",
    "customStatus": null,
    "output": [
        "Hello, Tokyo",
        "Hello, Seattle",
        "Hello, Cairo"
    ],
    "createdTime": "2023-02-13T23:02:21Z",
    "lastUpdatedTime": "2023-02-13T23:02:25Z"
}
  1. F1 > Azure Functions: Create Function > HTTP trigger > Give it a name (Ex: GetOrchestrationStatus)
  2. In GetOrchestrationStatus.ts (function made on step 5), copy-paste:
import { app, HttpRequest, HttpResponseInit, InvocationContext } from '@azure/functions';
import { getClient, input } from 'durable-functions';

export async function GetOrchestrationStatus(request: HttpRequest, context: InvocationContext): Promise<HttpResponseInit> {
    const { instanceId } = request.params;
    const client = getClient(context);

    const instance = await client.getStatus(instanceId, { showHistory: true });

    return { jsonBody: instance, status: 200 };
}

app.http('GetOrchestrationStatus', {
    route: ínstances/{instanceId},
    methods: ['GET','POST'],
    authLevel: 'anonymous',
    extraInputs: [input.durableClient()],
    handler: GetOrchestrationStatus
});
  1. local.settings.json:
{
    "IsEncrypted": false,
    "Values": {
        "AzureWebJobsStorage": "UseDevelopmentStorage=true",
        "FUNCTIONS_WORKER_RUNTIME": "node"
    }
}
  1. Hit F5 to run and debug
  2. Put a breakpoint on the return line on GetOrchestrationStatus
  3. Run an orchestration by using some tool like Yaak Ex: http://localhost:7071/api/orchestrators/TestOrchestrator
  4. Copy the orchestration instance ID (id on response)
  5. Now call the GetOrchestrationStatus Azure function: http://localhost:7071/api/instances/<id you just copied>
  6. Response from call from step 12 does not have the history key with events

Expected behavior
A clear and concise description of what you expected to happen.

durableClient.getStatus(instanceId, { showHistory: true }) return value has a history key and data.

Actual behavior
A clear and concise description of what actually happened.

durableClient.getStatus(instanceId, { showHistory: true }) return value does not return a history key nor data.

Screenshots
If applicable, add screenshots to help explain your problem.

Image

Known workarounds
Provide a description of any known workarounds you used.

Directly modify node_modules/durable-functions/lib/src/orchestrations/DurableOrchestrationStatus.js's constructor:

- this.history = init.history
+ this.history = init.historyEvents
  1. Not recommended to modify node_modules
  2. On package update, directory delete, or node_modules delete, changes will be eliminated

Additional context

  • Development environment (ex. Visual Studio)
  • Links to source
  • Additional bindings used
  • Function invocation IDs

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Priority 2 item

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions