Azure / Azure/azure-functions-host
JavaScript Function with Table Storage input binding: running 'forever' for unknown RowKey
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
My setup:
- macOS 10.13.6
- VS Code Version 1.28.2
- Azure Functions Core Tools (2.1.725 Commit hash: 68f448fe6a60e1cade88c2004bf6491af7e5f1df)
- Function Runtime Version: 2.0.12134.0
I have a very simple JavaScript function with Azure Table Storage input binding for a single item, like this:
```
module.exports = function (context, req) {
context.log('Start GetProduct...');
var product = context.bindings.product;
if(product) {
var result = {
id: product.RowKey, name: product.Name, description: product.Description, onStock: product.OnStock
};
context.res.status(200).json(result);
} else {
context.res.status(404);
}
};
```
WIth this metadata:
```
{
"disabled": false,
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": ["get"],
"route": "products/{productId}"
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"name": "product",
"type": "table",
"tableName": "products",
"partitionKey": "products",
"rowKey": "{productId}",
"direction": "in"
}
]
}
```
The expectation is when I use a 'wrong' (i.e. non-existent) RowKey as `productId` for the query the binding should immediately return and `context.bindings.product` should be e.g. null.
Actually, if I use an unknown id, the function runs forever, does never come back with any result and after 5 minutes it times out with this exception:
```
2018-11-05T13:39:15.022 [Error] Timeout value of 00:05:00 exceeded by function 'Functions.GetProduct' (Id: 'c9cd853e-a0e6-4cf7-9d5a-dec866796176'). Initiating cancellation.
2018-11-05T13:39:15.204 [Error] Executed 'Functions.GetProduct' (Failed, Id=c9cd853e-a0e6-4cf7-9d5a-dec866796176)
Timeout value of 00:05:00 was exceeded by function: Functions.GetProduct
```
This happens locally as well as when deployed to Azure Functions.
Thanks!
Contributor guide
Research direction
Start by running the shown JavaScript function locally with an unknown productId and inspect the table input binding described in the metadata. Compare its behavior with the expected null product and 404 response; done means an unknown RowKey returns promptly instead of running until the five-minute timeout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, javascript
- Domain
- backend, cloud, databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100