Azure / Azure/azure-functions-durable-js

Passing strings that look like dates from orquestator to activity changes the time zone

Open
#249 3 comments 1 reaction 0 assignees View on GitHub
bug Needs: Investigation :mag: P2
Dominant language
TypeScript
Stars
142
Forks
66
Avg merge
3d 19h
Merged PRs (30d)
4

Description

**Describe the bug**
I have an orchestator that sends an object to an activity that includes strings that look like dates, from localhost (-05:00) if I send a date like '2021-03-15T16:00:00-07:00' it gets changed to '2021-03-15T18:00:00-05:00'.

**Investigative information**

- Durable Functions extension version: 2.4.1
- durable-functions npm module version: ^1.4.6
- Language (JavaScript/TypeScript) and version: typescript ^3.3.3
- Node.js version: 10.23

***If deployed to Azure App Service***

- Timeframe issue observed: 2021-03-12T10:00:00-05:00 - 2021-03-12T23:00:00-05:00
- Function ID: Id=2b8e96e0-2ba6-499c-9d87-f6ec1f41db2b
- Region: East US
- Orchestration instance ID(s): I don't know

**To Reproduce**
Steps to reproduce the behavior:

Create an orchestator and an activity

Orchestator

```
const orchestrator = df.orchestrator(function* (context) {
const message = [[{
"fechaMedida":"2021-03-15T16:00:00-07:00",
"tipoMedicion":"medida"
}]]
yield context.df.callActivity('generar-publicar', message);
});

export default orchestrator;
```

Activity:

```
const activityFunction: AzureFunction = async function (context: Context): Promise {
const messages = context.bindings.messages;
context.log(`messages: ${JSON.stringify(messages)}`);
};

export default activityFunction;
```

Check the output in the log, the string changes to the time zone of your machine on localhost and to UTC in the server.

```
messages: [[{"fechaMedida":"2021-03-15T18:00:00-05:00","tipoMedicion":"medida"}]]
```

**Expected behavior**
An output log like this:

```
messages: [[{"fechaMedida":"2021-03-15T16:00:00-07:00","tipoMedicion":"medida"}]]
```

@davidmrdavid Here is the issue, hope it helps.

For now I am using JSON.stringfy() on the orchestator and JSON.parse on the activity to mitigate the problem.

Thanks.

Contributor guide

Open the contributing guide

Research direction

Start with the orchestrator's context.df.callActivity('generar-publicar', message) entry point and compare the activity's context.bindings.messages output using the provided ISO-8601 string. Reproduce the timezone conversion locally and in the server environment; done means the activity log preserves the original string exactly without requiring JSON.stringify/JSON.parse workarounds.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
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.