I'm following the guide https://mikhail.io/2017/12/precompiled-azure-functions-in-fsharp/:
- Created dotnet f# project:
dotnet new classlib --language F# --name HelloFunctions - Added reference to functions:
dotnet add package Microsoft.NET.Sdk.Functions - Added a new function as noted in file Library.fs below, added configuration files, etc.
- Compiled the function
- It successfully starts locally with
dotnet build && dotnet publish && cd bin/Debug/netstandard2.0/publish && func start. - Publish it to Azure:
func azure functionapp publish <name> - Azure sees the function, it is ok.
When I navigate to function by clicking its name in the tree the error popups:
Function ($Hello) Error: Microsoft.Azure.WebJobs.Host: Error indexing method 'Functions.Hello'. Microsoft.Azure.WebJobs.Host: Cannot bind parameter 'log' to type TraceWriter. 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.).- The function does not seem to be working. Perhaps because of the error above.
Library.fs
namespace HelloFunctions
open System
open Microsoft.Azure.WebJobs
open Microsoft.Azure.WebJobs.Host
module Say =
let private daysUntil (d: DateTime) =
(d - DateTime.Now).TotalDays |> int
let hello (timer: TimerInfo, log: TraceWriter) =
let christmas = new DateTime(2017, 12, 25)
daysUntil christmas
|> sprintf "%d days until Christmas"
|> log.Info