Azure-functions-host: Unable to bind parameter name in external file trigger

Created on 30 Jun 2017  Â·  8Comments  Â·  Source: Azure/azure-functions-host

When using the external file trigger out of the box it throws an exception:

Exception while executing function: Functions.ExternalFileTriggerCSharp1
Microsoft.Azure.WebJobs.Host.FunctionInvocationException : Exception while executing function: Functions.ExternalFileTriggerCSharp1 ---> System.AggregateException : One or more errors occurred. ---> Exception binding parameter 'name' ---> Binding data does not contain expected value 'name'.
   at Microsoft.Azure.WebJobs.Host.Executors.DelayedException.Throw()
   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithWatchersAsync(IFunctionInstance instance,IReadOnlyDictionary`2 parameters,TraceWriter traceWriter,ILogger logger,CancellationTokenSource functionCancellationTokenSource)
   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)
   at async Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.ExecuteWithLoggingAsync(??)
---> (Inner Exception #0) System.InvalidOperationException : Exception binding parameter 'name' ---> System.InvalidOperationException : Binding data does not contain expected value 'name'.
   at Microsoft.Azure.WebJobs.Host.Bindings.Data.ClassDataBinding`1.BindAsync(BindingContext context)
   at async Microsoft.Azure.WebJobs.Host.Triggers.TriggeredFunctionBinding`1.BindCoreAsync[TTriggerValue](ValueBindingContext context,Object value,IDictionary`2 parameters) 
   End of inner exception<---

---> (Inner Exception #1) System.InvalidOperationException : Exception binding parameter '_return' ---> System.InvalidOperationException : No value for named parameter 'name'.
   at Microsoft.Azure.WebJobs.Host.Bindings.Path.BindingTemplateToken.ExpressionToken.Evaluate(IReadOnlyDictionary`2 bindingData)
   at Microsoft.Azure.WebJobs.Host.Bindings.Path.BindingTemplate.Bind(IReadOnlyDictionary`2 parameters)
   at Microsoft.Azure.WebJobs.Extensions.ApiHub.Common.GenericOutStringFileBinding`2.BindAsync(BindingContext context)
   at async Microsoft.Azure.WebJobs.Host.Triggers.TriggeredFunctionBinding`1.BindCo…

Run.csx

using System;

public static string Run(string inputFile, string name, TraceWriter log)
{
    log.Info($"C# External trigger function processed file: " + name);
    return inputFile;
}

Function.json

{
  "bindings": [
    {
      "type": "apiHubFileTrigger",
      "name": "inputFile",
      "direction": "in",
      "path": "input-cs/{name}",
      "connection": "filesystem_FILESYSTEM"
    },
    {
      "type": "apiHubFile",
      "name": "$return",
      "direction": "out",
      "path": "output-cs/{name}",
      "connection": "filesystem_FILESYSTEM"
    }
  ],
  "disabled": false
}

If I remove the name argument in azure function, the trigger works and I can access the file content, but I am not able to get the file name ... Any ideas on how to fix this?

needs-investigation

Most helpful comment

Is this functionality supposed to be working in portal? External File Trigger CSharp? Not able to connect to OneDrive or OneDrive Business in my trials

All 8 comments

This is because you are using a 'File System' connection which is not yet supported. Have you tried using a DropbBox, Box, ... connection? I just tested it and it is working fine with those connections.

Thank you for the clarification. Do you have an idea when the feature will become supported for 'File System'?

I'm also having an issue where the filename of the file that triggered the event (in this case a Dropbox connector) is not available. When is this feature going to be made available?

It should work for Dropbox connectors. see example above. If not working for you then feel free to share your function.json file as well your code. thanks

@safihamid Is there a timeframe when the external file trigger will be available and working for Azure Function?

Not at the moment, this was an experimental feature which is not actively being worked on anymore.

Is this functionality supposed to be working in portal? External File Trigger CSharp? Not able to connect to OneDrive or OneDrive Business in my trials

I tried using external file trigger for FTP and it is giving me the below error
[Error] Exception while executing function: Functions.ExternalFileTriggerCSharp1. Microsoft.Azure.WebJobs.Host: One or more errors occurred. Exception binding parameter 'inputFile'. Microsoft.Azure.ApiHub.Sdk: /apim/ftp/098e9d0acab34ac29451e6df6f1ceec6/datasets/default/GetFileContentByPath?path=input-cs/%7Byour%20file%7D.
2019-01-31T10:42:16.448 [Error] Function completed (Failure, Id=1b1ba11f-59af-4665-8c52-78498e61a4fd, Duration=65217ms)

below is my code
{
"bindings": [
{
"type": "apiHubFileTrigger",
"name": "inputFile",
"direction": "in",
"path": "input-cs/{name}",
"connection": "ftp1_FTP"
},
{
"type": "apiHubFile",
"name": "$return",
"direction": "out",
"path": "output-cs/{name}",
"connection": "ftp1_FTP"
}
],
"disabled": false
}


r "Microsoft.Azure.WebJobs.Extensions.ApiHub"

using System.Net;
using Microsoft.Azure.WebJobs;

public static string Run(string inputFile, string name, TraceWriter log)
{
log.Info($"C# External trigger function processed file: " + name);
return inputFile;
}

Was this page helpful?
0 / 5 - 0 ratings