Reputation: 514
I have a C# Azure durable function that needs to read data from some tables and put data in other tables, in response to some inbound JSON it receives via an HTTP trigger. Everything has been coming along nicely. Now, the exact same syntax and methods that I've used to make earlier queries in my code suddenly don't return any results. I'm sure that I must be overlooking something obvious.
Here, I bind the CloudTable, exactly as I do for the other queries that work:
[Table ("ProductFeatures")] CloudTable ProductFeatures,
I define the table entity:
public class FeatureEntity : TableEntity
{
public string productcode {get;set;}
public string featurecode {get;set;}
public string featurefriendlyname {get;set;}
}
Unless I've missed something, this matches what's in the Table, and, as you can see, there are actual entries that ought to be returned if I try to match productcode
"test" which I've verified through logging is the value of prodcode
which is used in the query (below) in trying to perform the match.
And here I query against it:
var ProdFeatures = new List<FeatureEntity>();
TableQuery<FeatureEntity> featureQuery = new TableQuery<FeatureEntity>()
.Where(TableQuery.GenerateFilterCondition("productcode", QueryComparisons.Equal, prodcode));
// TableContinuationToken ct = null; <== declared in previous query, so we reset it
ct = null;
try
{
do
{
var page = await ProductFeatures.ExecuteQuerySegmentedAsync(featureQuery, ct);
ct = page.ContinuationToken;
ProdFeatures.AddRange(page.Results);
}
while (ct != null);
}
Next, we do a check against ProdFeatures
:
if (ProdFeatures.Count == 0)
{
log.LogInformation($"[{Product}]: No features found - Processing Terminated");
return false;
}
I use this exact same approach for 2 queries before I get to this one so I'm really confused why it's not returning any results. I feel like this is probably something really stupid that I'm missing, but I've been over it multiple times and can't figure out why it isn't returning the matching data that you can see in image of the table.
This is occurring in an async task function called by the durable functions orchestrator:
Boolean success = await context.CallActivityAsync<Boolean>("DoQueueItem",data);
Where the task is defined like so:
[FunctionName("DoQueueItem")]
public static async Task<Boolean> DoQueueItem([ActivityTrigger] MySpecialItem Item,
[Table ("ProductFeatures")] CloudTable ProductFeatures,
ILogger log)
The total runtime is < 5 seconds, so I don't think I'd be running afoul of any processing limitation, but I'm very new to Azure and wondering if there could be something of an environmental or contextual nature with durable functions in general that could affect this.
Upvotes: 0
Views: 306
Reputation: 6508
In your Function annotation, I don't see you passing the Connection parameter in Table input binding:
[FunctionName("DoQueueItem")]
public static async Task<Boolean> DoQueueItem([ActivityTrigger] MySpecialItem Item,
[Table ("ProductFeatures", Connection = "StorageConnectionAppSetting")] CloudTable ProductFeatures,
ILogger log)
I suspect because of that it is not connecting to your desired storage account (by default, it uses the same function host storage if you do not specify connection). Refer this for details.
Connection: The name of an app setting that contains the Storage connection string to use for this binding. For example, if you set connection to "MyStorage", the Functions runtime looks for an app setting that is named "MyStorage". If you leave connection empty, the Functions runtime uses the default Storage connection string in the app setting that is named AzureWebJobsStorage.
Upvotes: 1