1

When I deploy an Azure Function from Visual Studio, the function.json file is always incorrect. An example of the function.json file is the following for a queue triggered function:

{
  "generatedBy": "Microsoft.NET.Sdk.Functions-1.0.12",
  "configurationSource": "attributes",
  "bindings": [
{
  "type": "queueTrigger",
  "connection": "AzureWebJobsStorage",
  "queueName": "queue",
  "name": "myQueueItem"
}
],
  "disabled": false,
  "scriptFile": "../bin/x.dll",
  "entryPoint": "x"
}

The correct function.json in order for the function to work in azure is:

{
      "bindings": [
{
  "type": "queueTrigger",
  "connection": "AzureWebJobsStorage",
  "direction" : "in",
  "queueName": "queue",
  "name": "myQueueItem"
}
],
  "disabled": false,
  "scriptFile": "../bin/x.dll",
  "entryPoint": "x"
}

Is there any solution to automated deployments/ Visual Studio deployments that would do this automatically? Currently I am editing all the function.json files every deployment. Any solutions or workarounds would be appreciated.

Jerry Liu
  • 17,282
  • 4
  • 40
  • 61
Darth Veder
  • 159
  • 2
  • 11
  • what do you mean by `the function.json file is wrong`. The 1st one looks ok. Have you found any issue with the 1st one ? – Thomas Sep 09 '18 at 08:51
  • The first one would not work when deployed to azure. I have tried this many times, each deployment I need to edit the function.json to the format of the 2nd file – Darth Veder Sep 10 '18 at 02:11
  • I've been using the functions sdk quite a lot and it is working fine. Are you targetting azure functions runtime v1/v2 ? .net core or .net framework ? Have you tried to get latest nuget package `Microsoft.NET.Sdk.Functions` ? – Thomas Sep 10 '18 at 06:12
  • Currently using azure functions runtime v1 I have the most recent nuget package for Microsoft.NET.Sdk.Functions – Darth Veder Sep 13 '18 at 18:20
  • @Thomas Im using .net framework as well – Darth Veder Sep 14 '18 at 21:01

1 Answers1

0

Agree with @Thomas, have tested v1 queue trigger template with Microsoft.NET.Sdk.Functions-1.0.12 and latest Microsoft.NET.Sdk.Functions-1.0.22, function.json generated by VS does work.

Actually two function.json both work on Azure, those two line below are used to tell function.json is generated by VS and not recommended to be modified after deployment.

"generatedBy": "Microsoft.NET.Sdk.Functions-1.0.22",
"configurationSource": "attributes",

The first one would not work

Function execution result may not be shown instantly, you could go to https://functionappname.scm.azurewebsites.net/DebugConsole and navigate to D:\home\LogFiles\Application\Functions\function\{FunctionName} to check log files.

Also you can visit D:\home\LogFiles\Application\Functions\Host to detect detailed host logs.

If you are still troubled, you could elaborate would not work with details and show us your code.

Jerry Liu
  • 17,282
  • 4
  • 40
  • 61
  • How about a queue trigger template with an output binding as well? The deployments I make don't create an output binding – Darth Veder Sep 20 '18 at 18:14
  • @DarthVeder This is by design, output binding is not built into `function.json`, only trigger info is available. – Jerry Liu Sep 21 '18 at 02:21