Azure / Azure/azure-functions-durable-js
Entity exception details lost in orchestrator
- Dominant language
- TypeScript
- Stars
- 142
- Forks
- 66
- Avg merge
- 3d 19h
- Merged PRs (30d)
- 4
Description
**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:
```typescript
// 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 = (context: EntityContext) => {
const instanceId = context.df.getInput();
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
Contributor guide
Research direction
Start at the callEntity path and the entity failure-handling or serialization entry points in the TypeScript library. Reproduce the CatchEntityOrchestration and Counter example, then trace how the thrown Error becomes the orchestration's caught value. Done means the inner and outer exception details are available instead of '[object Object]'.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend-api-design, distributed-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100