Azure / Azure/azure-functions-host

Node.js Azure function input binding for Table storage ignores rowKey

Open
#10,356 11 comments 0 reactions 0 assignees View on GitHub
bot: do not close Needs: Attention :wave:
Dominant language
C#
Stars
2k
Forks
482
Avg merge
2d 10h
Merged PRs (30d)
36

Description

I have a simple Node.js Azure function (runtime v4) with input binding for Azure Table storage as follows:
```ts
import { app, HttpRequest, HttpResponseInit, InvocationContext, input } from "@azure/functions";

const tableInput = input.table({
tableName: 'Person',
partitionKey: 'Test',
rowKey: '{key}',
connection: 'AzureWebJobsStorage',
});

export async function readTable(request: HttpRequest, context: InvocationContext): Promise {
context.log(`Http function processed request for url "${request.url}"`);

const tableData = context.extraInputs.get(tableInput)

return { jsonBody: tableData };
};

app.http('readTable', {
methods: ['GET'],
route: 'read/{key}',
extraInputs: [tableInput],
authLevel: 'anonymous',
handler: readTable
});
```
The result of this function is however all the rows in `Person` table with `Test` partition key, instead of just one (or none) with given `rowKey`.

The behaviour is the same localy (with Azurite as storage emulator) and when deployed to Azure.

Node.js v20, @azure/functions v4.5.0

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue with the shown readTable function, input.table configuration, context.extraInputs.get call, and the read/{key} route, first comparing results locally with Azurite and in Azure. Trace how the Node.js Azure Table input binding handles partitionKey and rowKey; done means the binding returns only the matching row or no row for an absent rowKey in both environments.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, node.js, typescript
Domain
backend, cloud, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.