dapr / dapr/js-sdk

[Workflows] Error propagation from Activity to Workflow does not work

Open
#708 4 comments 0 reactions 1 assignee Claimed by @WhitWaldo View on GitHub
area/workflow P0
Dominant language
JavaScript
Stars
217
Forks
104
PR merge metrics
No merged PRs in 30d

Description

## Expected Behavior

When an Activity throws an `Error` I would expect the error to be successfully propagated back to the Workflow, where it can be gracefully handled using normal `try catch` (or not, and allowed to transistion the workflow into a runtime `FAILED` status)

## Actual Behavior

- propagating of error fails
- Workflow remains in a `RUNNING` state, and is now stuck.

## Steps to Reproduce the Problem

Using the Dapr QuickStarts, modify one of the Activities within [orderProcessingWorkflow.ts](https://github.com/dapr/quickstarts/blob/release-1.15/workflows/javascript/sdk/order-processor/orderProcessingWorkflow.ts) and throw an error e.g `throw new Error("Something went wrong!");`

Build the app, and start a new workflow.

Observe the logs :

```
== APP - order-processor == Verifying inventory for b6c25c32-1d7c-4e5d-8178-852fdfe324c5 of 1 car
== APP - order-processor == Error: Something went wrong!
== APP - order-processor == at verifyInventoryActivity (/Users/olivertomlinson/Desktop/dev/quickstarts/workflows/javascript/sdk/dist/orderProcessingWorkflow.js:17:11)
== APP - order-processor == at activityWrapper (/Users/olivertomlinson/Desktop/dev/quickstarts/workflows/javascript/sdk/node_modules/@dapr/dapr/workflow/runtime/WorkflowRuntime.js:85:20)
== APP - order-processor == at ActivityExecutor.execute (/Users/olivertomlinson/Desktop/dev/quickstarts/workflows/javascript/sdk/node_modules/@dapr/durabletask-js/worker/activity-executor.js:21:30)
== APP - order-processor == at TaskHubGrpcWorker._executeActivity (/Users/olivertomlinson/Desktop/dev/quickstarts/workflows/javascript/sdk/node_modules/@dapr/durabletask-js/worker/task-hub-grpc-worker.js:237:43)
== APP - order-processor == at ClientReadableStreamImpl. (/Users/olivertomlinson/Desktop/dev/quickstarts/workflows/javascript/sdk/node_modules/@dapr/durabletask-js/worker/task-hub-grpc-worker.js:132:26)
== APP - order-processor == at ClientReadableStreamImpl.emit (node:events:512:28)
== APP - order-processor == at addChunk (node:internal/streams/readable:324:12)
== APP - order-processor == at readableAddChunk (node:internal/streams/readable:297:9)
== APP - order-processor == at Readable.push (node:internal/streams/readable:234:10)
== APP - order-processor == at Object.onReceiveMessage (/Users/olivertomlinson/Desktop/dev/quickstarts/workflows/javascript/sdk/node_modules/@grpc/grpc-js/build/src/client.js:349:24)
== APP - order-processor == An error occurred while trying to execute activity 'verifyInventoryActivity': Something went wrong!
== APP - order-processor == Failed to deliver activity response for 'verifyInventoryActivity#2' of orchestration ID 'b6c25c32-1d7c-4e5d-8178-852fdfe324c5' to sidecar: 2 UNKNOWN: unknown instance ID/task ID combo: /2
```

fetch the status of the workflow and notice it is still in `running` state

```
{
"instanceID": "b6c25c32-1d7c-4e5d-8178-852fdfe324c5",
"workflowName": "orderProcessingWorkflow",
"createdAt": "2025-07-04T08:57:26.547359Z",
"lastUpdatedAt": "2025-07-04T08:57:26.576156Z",
"runtimeStatus": "RUNNING",
"properties": {
"dapr.workflow.input": "{\"itemName\":\"car\",\"totalCost\":5000,\"quantity\":1}"
}
}
```

**note** : If you stop and restart the App, you will see the same error.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.