1
votes

The Methods property of HttpTrigger attribute does not populate function.json

[<FunctionName("HttpFunc")>]
let run([<HttpTrigger(AuthorizationLevel.Anonymous, Route = "hellosanta", Methods = [|"get"|])>] req: HttpRequest, log: TraceWriter) =

results in the following function.json

{
  "generatedBy": "Microsoft.NET.Sdk.Functions.Generator-1.0.7",
  "configurationSource": "attributes",
  "bindings": [
    {
      "type": "httpTrigger",
      "route": "hellosanta",
      "methods": [],
      "authLevel": "anonymous",
      "name": "req"
    }
  ],
  "disabled": false,
  "scriptFile": "../bin/HttpFunc.dll",
  "entryPoint": "HttpFunc.PrecompiledHttp.run"
}

Microsoft.NET.Sdk.Functions (1.0.7)

(multiple versions of WebJobs are showing up in the dependency graph)

Microsoft.Azure.WebJobs (2.1.0-beta4) - restriction: || (== net47) (&& (== netstandard2.0) (>= net46))

Microsoft.Azure.WebJobs (3.0.0-beta4) - restriction: || (&& (== net47) (< net46) (>= netstandard2.0)) (== netstandard2.0)

Microsoft.Azure.WebJobs.Extensions (2.1.0-beta4) - restriction: || (== net47) (&& (== netstandard2.0) (>= net46))

Microsoft.Azure.WebJobs.Extensions (3.0.0-beta4) - restriction: || (&& (== net47) (< net46) (>= netstandard2.0)) (== netstandard2.0)

Microsoft.Azure.WebJobs.Extensions.Http (1.0.0-beta4) - restriction: || (== net47) (&& (== netstandard2.0) (>= net46))

Microsoft.Azure.WebJobs.Extensions.Http (3.0.0-beta4) - restriction: || (&& (== net47) (< net46) (>= netstandard2.0)) (== netstandard2.0)

This was also reported to https://github.com/Azure/Azure-Functions/issues/645

1

1 Answers

2
votes

I'm a bit puzzled why your code even compiles, since Methods has a private setter...

Anyway, the following works for me:

[<HttpTrigger(AuthorizationLevel.Anonymous, [|"get"|], Route = "hellosanta")>]

or simply

[<HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "hellosanta")>]