Azure / Azure/azure-functions-durable-js

Is async supported in Durable Entity?

Open
#144 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
142
Forks
66
Avg merge
3d 19h
Merged PRs (30d)
4

Description

**Describe the bug**
await function doesn't work in Durable Entity.

**Investigative information**

- Durable Functions extension version: 2.1.0
- durable-functions npm module version: 1.3.1
- Language (JavaScript/TypeScript) and version: JavaScript
- Node.js version: 10.18.0

**To Reproduce**
```js
const df = require("durable-functions");

module.exports = df.entity(async function(context) {
const currentValue = context.df.getState(() => 0);
switch (context.df.operationName) {
case "add":
await new Promise((f, r) => {
setTimeout(() => {
context.df.setState(currentValue + 1);
f();
}, 1000);
});
break;
case "reset":
context.df.setState(0);
break;
case "get":
context.df.return(currentValue);
break;
}
});

```

**Actual behavior**
State isn't updated when "add" is called.

**Additional context**
https://github.com/Azure/azure-functions-durable-js/blob/bbb0f8b6a2f3fa4b628686f74b196d88edf80a4e/src/entity.ts#L33

Contributor guide

Open the contributing guide

Research direction

Start at src/entity.ts#L33 and run the provided JavaScript Durable Entity reproduction with the listed Durable Functions and Node.js versions. Trace how the async entity handler is invoked and verify whether the add operation updates state after the delayed promise resolves; done means the supported behavior is established and reflected in an appropriate project test or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.