Azure-Functions icon indicating copy to clipboard operation
Azure-Functions copied to clipboard

[ActivityTrigger] parameter named "data" causes error on local startup

Open dlyall-maine opened this issue 6 years ago • 12 comments
trafficstars

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.

dlyall-maine avatar Jul 20 '19 18:07 dlyall-maine

@jeffhollan

ColbyTresness avatar Jul 22 '19 20:07 ColbyTresness

Had the exact same issue with the parameter named "data" in Python 3.8, changed it to something else and it worked. Thank you.

alexis-franche avatar Jan 19 '21 16:01 alexis-franche

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! 😢

kwaazaar avatar Apr 21 '21 13:04 kwaazaar

Spent a day troubleshooting this... It's never where you think it is.... Please just add a better error message.

johankson avatar Mar 04 '22 21:03 johankson

@cgillum

aressler38 avatar Mar 09 '22 20:03 aressler38

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 avatar Mar 10 '22 18:03 cgillum

@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.

mathewc avatar Mar 10 '22 23:03 mathewc