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

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

Open
JPF3N998 opened this issue Dec 21, 2024 · 0 comments
Labels
P2 Priority 2 item

Comments

@JPF3N998
Copy link

JPF3N998 commented Dec 21, 2024

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Priority 2 item
Projects
None yet
Development

No branches or pull requests

2 participants