Problem
When using Microsoft.NET.Sdk.Functions v1.0.8 so I can use the [NoAutomaticTrigger] trigger (#140), the generated function.json is invalid.
Reproduction path
[NoAutomaticTrigger] attributeResult
Status: 404 Not FoundThe following 1 functions are in error:
Generated function.json
{
"generatedBy": "Microsoft.NET.Sdk.Functions.Generator-1.0.8",
"configurationSource": "attributes",
"bindings": [
{
"type": "manualTrigger",
"direction": "in"
}
],
"disabled": false,
"scriptFile": "../bin/[path].Hosts.FunctionApp.dll",
"entryPoint": "[Path].Run"
}
Workaround
If I manually add the name attribute in the bindings section using Kudu, the function works:
{
"generatedBy": "Microsoft.NET.Sdk.Functions.Generator-1.0.8",
"configurationSource": "attributes",
"bindings": [
{
"name": "InsertNameHere",
"type": "manualTrigger",
"direction": "in"
}
],
"disabled": false,
"scriptFile": "../bin/[path].Hosts.FunctionApp.dll",
"entryPoint": "[Path].Run"
}
Unfortunately, https://github.com/Azure/azure-functions-host/wiki/function.json (which I used as a reference when implementing #140) describes an invalid manual trigger binding. Fortunately, there is an easier way than editing the function.json file in Kudu: just add a string input argument to your [NoAutomaticTrigger] function to generate a valid function.json file.
@mathewc I think the fix for this should go in the runtime. Is there a reason name is required for manualTrigger? A manual trigger function deson't need to have parameters, and if it doesn't we don't know what to put in that name property.
The solution from @0xced works!
public static async Task Run(string input, TraceWriter log)
Creates the following (valid) function.json:
{
"generatedBy": "Microsoft.NET.Sdk.Functions-1.0.12",
"configurationSource": "attributes",
"bindings": [
{
"type": "manualTrigger",
"direction": "in",
"name": "input"
}
],
"disabled": false,
"scriptFile": "../bin/{namespace}.dll",
"entryPoint": "{namespace}.Run"
}
Not doing anything with the input, other than that it creates the proper json. Thanks!
Closing since the issue is fixed per this comment - https://github.com/Azure/azure-functions-vs-build-sdk/issues/168#issuecomment-378913905
@vijayrkn The issue is not fixed, that is a workaround.
@zmarty I have re-opened. @soninaren - This is an issue in the actual generation. Can you have someone take a look?
Most helpful comment
Unfortunately, https://github.com/Azure/azure-functions-host/wiki/function.json (which I used as a reference when implementing #140) describes an invalid manual trigger binding. Fortunately, there is an easier way than editing the function.json file in Kudu: just add a
string inputargument to your [NoAutomaticTrigger] function to generate a valid function.json file.