Azure / azure-webjobs-sdk-extensions

Azure WebJobs SDK Extensions
MIT License
342 stars 206 forks source link

[BUG] table_input - row_key parameter is ignored #848

Open obesser opened 1 year ago

obesser commented 1 year ago

I am using Azurite to test this binding. While the partition_key and filter parameters work as expected, the row_key parameters seems to be completely ignored.

@app.route(route="req")
@app.table_input(connection="CS", arg_name="arg", table_name="table_name", partition_key="xxx", row_key="abc")
def main(req: func.HttpRequest, arg):
    return arg

This is the Azurite trace message when invoking the function, RowKey is not being added to the filter: GET /devstoreaccount1/table_name()?$format=application%2Fjson%3Bodata%3Dminimalmetadata&$filter=PartitionKey%20eq%20%27xxx%27 HTTP/1.1

Core Tools Version: 4.0.5095 Commit hash: N/A (64-bit) Function Runtime Version: 4.16.5.20396

bhagyshricompany commented 1 year ago

Thanks for informing pls share the all repro steps

obesser commented 1 year ago

Repro steps

You can use Storage Explorer and the Azurite emulator or an actual Azure Storage Table to perform these steps.

  1. Create a table named table_name
  2. Insert 2 entities: PartitionKey: xxx, RowKey: abc PartitionKey: xxx, RowKey: def
  3. Create an App setting named CS with the table connection string (the above link contains a connection string for the emulator).
  4. Run the above function, no additional packages required. The function should return only the abc entity, but it returns both of them.
pdthummar commented 1 year ago

@obesser Thanks for reporting the issue. I have replicated the issue and it returns both. Transferring to extension team for further investigation.

mpth commented 3 months ago

I just spent hours debugging this until I found this issue. I'm surprised this is over a year old and not fixed yet. I'm sure it used to work and broke at some point after upgrading the functions runtime.

Maybe you should add a warning to the docs that this here is just not working.

https://learn.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook-trigger?tabs=python-v2%2Cisolated-process%2Cnodejs-v4%2Cfunctionsv2&pivots=programming-language-javascript#using-route-parameters

In my case, I'm using node, not python and I tried both v3 and v4 programming models.

mpth commented 3 months ago

Not sure but is this where rowKey should be evaluated but is not?

https://github.com/Azure/azure-sdk-for-net/blob/3d1ea647678a64e880931adb2b4cd70628d8f6ea/sdk/tables/Microsoft.Azure.WebJobs.Extensions.Tables/src/TablesExtensionConfigProvider.cs#L135