Azure / Azure/azure-iot-hub-node

scheduleTwinUpdate throws an error if "maxExecutionTimeInSeconds" isn't set even if it's marked as optional

Open
#29 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3
Forks
18
PR merge metrics
No merged PRs in 30d

Description

# Problem encounter
The "maxExecutionTimeInSeconds" property is marked as optional in your [typing file](https://github.com/Azure/azure-iot-hub-node/blob/0768e4016cde4b4a7074b90502bacc6d525d3577/src/job_client.ts#L274), but it isn't really.
In fact, depending on the parameters passed, you may or may not set a default value. The problem is that the Microsoft API expects a value, and so, when you don't set a default value, the API throws an error...

# What should happen ?
In ALL cases, when the property "maxExecutionTimeInSeconds" isn't set, you should set the default one OR never set it but ask the developer to set a value

# Code to reproduce
```Javascript
const { JobClient } = require('azure-iothub')

const jobClient = JobClient.fromConnectionString(process.env['IotHubConnectionString'])

setImmediate( async () => {
const id = 'aRandomId'
await jobClient.scheduleTwinUpdate(
id,
"tags.model = 'test' AND deviceId IN ['aValidDeviceId']",
{
etag: '*',
tags: { model: 'test', firmwareGroup: 'test-group-A' },
properties: {
desired: {
firmware: 'aValue'
}
}
},
new Date()
)
})

```

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.