Azure / Azure/azure-functions-durable-js
Durable function `raiseEvent` method throws if orchestration function with supplied instanceId does not exist
- Dominant language
- TypeScript
- Stars
- 142
- Forks
- 66
- Avg merge
- 3d 19h
- Merged PRs (30d)
- 4
Description
The documentation for [Send events](https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-external-events?tabs=javascript#send-events) section in the notes states `If there is no orchestration instance with the specified instance ID, the event message is discarded.`

This would imply, that when non existing `instanceId` is passed, that the call simply does nothing.
```ts
await client.raiseEvent( // based on docs this should just do nothing if orchestration function with ID my-nonexisting-id does not exist
"my-nonexisting-id",
"SomeEvent",
null
);
```
However in reality when `raiseEvent` method is invoked with non-existing `instanceId` it throws an error:
```
Error: No instance with ID 'my-nonexisting-id' found.
at DurableClient. (C:\Users\nej\source\repos\azf-samples-ts\node_modules\durable-functions\lib\src\durableClient\DurableClient.js:240:43)
at Generator.next ()
at fulfilled (C:\Users\nej\source\repos\azf-samples-ts\node_modules\durable-functions\lib\src\durableClient\DurableClient.js:5:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5
```
**Expected behavior**
Either adjust documentation to state that `raiseEvent` throws in case of non-existing `instanceId` or adjust implementation to not throw in such case.
**Actual behavior**
If `raiseEvent` method is invoked with non-existing `instanceId` it throws an error.
Contributor guide
Research direction
Read the linked Send events documentation and inspect DurableClient.js around line 240, where the reported error is raised. Reproduce the call with a nonexistent instance ID, then determine whether the documented discard behavior or the observed exception is the intended contract. Done means the documentation and implementation agree, with the behavior verified for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100