Skip to content

Entity exception details lost in orchestrator #642

@andystaples

Description

@andystaples

Describe the bug
When an entity throws an exception, the Error received by the orchestration that called the entity has the message '[object Object]' instead of the error details that were thrown

Investigative information

  • Durable Functions extension version: 3.3.0
  • durable-functions npm module version: 3.1.0
  • Language (JavaScript/TypeScript) and version: TypeScript ^4.0.0
  • Node.js version: v22.15.0

If deployed to Azure App Service

N/A

To Reproduce
Steps to reproduce the behavior:

Code:

// Orchestration: CatchEntityOrchestration
const CatchEntityOrchestration: OrchestrationHandler = function* (context: OrchestrationContext) {
    const entityId = new df.EntityId("Counter", "myCounter");
    try {
        yield context.df.callEntity(entityId, "get", context.df.instanceId);
        return "Success";
    } catch (e: any) {
        return String(e);
    }
};
df.app.orchestration("CatchEntityOrchestration", CatchEntityOrchestration);

// Entity: Counter
const Counter: EntityHandler<string> = (context: EntityContext<string>) => {
    const instanceId = context.df.getInput<string>();
    if (!instanceId) {
        throw new Error("Did not get a valid instanceId as input to the entity");
    }
    if (!(instanceId in attemptCount)) {
        attemptCount[instanceId] = 1;
        const inner = new Error("Inner exception message");
        const err = new Error("This entity failed\r\nMore information about the failure");
        (err as any).cause = inner;
        throw err;
    }
    attemptCount[instanceId] += 1;
    context.df.return(0);
};
df.app.entity("Counter", Counter);

While not required, providing your orchestrator's source code in anonymized form is often very helpful when investigating unexpected orchestrator behavior.

Expected behavior
The "Inner exception message" and "This entity failed..." details should propagate to the orchestrator

Actual behavior
The Error received by the orchestrator has the message '[object Object]'

Screenshots
N/A

Known workarounds
N/A

Additional context

  • Development environment (ex. Visual Studio): Visual Studio + Core Tools

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