Azure-Functions
Azure-Functions copied to clipboard
[ActivityTrigger] parameter named "data" causes error on local startup
Here's the method:
[FunctionName(nameof(DoActivity))]
public static async Task<string> DoActivity([ActivityTrigger]string data, ILogger log)
{
log.LogInformation($"hashing {data}");
return data.GetHashCode().ToString();
}
Here's the error that appears in the console window:
[7/20/2019 6:01:27 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'DoActivity'. Microsoft.Azure.WebJobs.Host: Can't bind parameter 'data' to type 'System.String'. [7/20/2019 6:01:27 PM] Error indexing method 'DoActivity' [7/20/2019 6:01:27 PM] Microsoft.Azure.WebJobs.Host: Error indexing method 'DoActivity'. Microsoft.Azure.WebJobs.Host: Can't bind parameter 'data' to type 'System.String'.
When parameter "data" is renamed to, say, "info" the error goes away.
@jeffhollan
Had the exact same issue with the parameter named "data" in Python 3.8, changed it to something else and it worked. Thank you.
So I've just been troubleshooting this same issue, researching different kind of reasons. But not expecting the parameter name to be the issue! This really needs a fix or a compile (or runtime) error, guys! 😢
Spent a day troubleshooting this... It's never where you think it is.... Please just add a better error message.
@cgillum
Removing Jeff from the assignment. @anirudhgarg @mathewc what's the right way to triage this issue? It's an error message generated by the Functions host (not sure if it's Functions or WebJobs) that's impacting Durable Functions customers.
Related: https://github.com/Azure/azure-functions-durable-extension/issues/1062.
@cgillum The fact that your binding has a "data" member as part of the BindingContract shouldn't cause the trigger parameter to fail binding. I just tried to repro with QueueTrigger which has a contract member DequeueCount here. I'm able to use that name for the trigger binding no problem:
public void ProcessMessage([QueueTrigger("test")] string dequeueCount, ILogger logger)
Perhaps there is something unique with the Durable extension. Does it only happen in Functions, or outside of functions as well? Would be good to debug a minimal repro locally to find out exactly why/where your binding is failing indexing.