I'm not able to bind an input parameter of type blob to either string/TextReader without using the [BlobAttribute] in a C# implementation (not CSX).
The error I'm getting is:
Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.Harvester'.
Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'configReader' to type
TextReader. Make sure the parameter Type is supported by the binding. If
you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure
you've called the registration method for the extension(s) in your startup
code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).
function.config:
"bindings": [
{
"type": "timerTrigger",
"schedule": "0 */5 * * * *",
"useMonitor": true,
"runOnStartup": false,
"direction": "in",
"name": "myTimer"
},
{
"type": "blob",
"name": "configReader",
"path": "secured/app.config.json",
"connection": "XXX",
"direction": "in"
}
],
Function signature (NOT BINDING configReader
):
[FunctionName("Harvester")]
public static async Task Run(
[TimerTrigger("0 */5 * * * *")]TimerInfo myTimer,
TraceWriter log,
TextReader configReader)
This would work though (BINDING configReader
:
[FunctionName("Harvester")]
public static async Task Run(
[TimerTrigger("0 */5 * * * *")]TimerInfo myTimer,
TraceWriter log,
[Blob("secured/app.config.json", FileAccess.Read)]TextReader configReader)
Any idea on how to get it working without specifying the blob path in BlobAttribute
. I'd ideally keep the Blob config outside of the code, that way my function would become more portable.