Azure / Azure/azure-functions-dotnet-worker

No job functions found running an F# function

Open
#364 3 comments 0 reactions 1 assignee Claimed by @fabiocav View on GitHub
area: documentation enhancement
Dominant language
C#
Stars
466
Forks
215
Avg merge
3d 10h
Merged PRs (30d)
7

Description

If I take the templated C# function, port the project to F# and attempt `func start`

I get:

```
Azure Functions Core Tools
Core Tools Version: 3.0.3388 Commit hash: fb42a4e0b7fdc85fbd0bcfc8d743ff7d509122ae
Function Runtime Version: 3.0.15371.0

[2021-03-23T09:53:46.162Z] No job functions found. Try making your job classes and methods public. If you're using binding extensions (e.g. Azure Storage, ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. builder.AddAzureStorage(), builder.AddServiceBus(), builder.AddTimers(), etc.).
For detailed output, run func with --verbose flag.
[2021-03-23T09:53:51.196Z] Host lock lease acquired by instance ID '000000000000000000000000BD321FD0'.
```

I'm hoping that I just missed something obvious, but at this point its not clear what that might be.

The ported code is as below

_HttpExample.fs:_

```fsharp

namespace fsharp_isolated

open System.Collections.Generic;
open System.Net;
open Microsoft.Azure.Functions.Worker;
open Microsoft.Azure.Functions.Worker.Http;
open Microsoft.Extensions.Logging;

module HttpExample =

[]
let Run ([] req : HttpRequestData , executionContext : FunctionContext ) : HttpResponseData =
let logger = executionContext.GetLogger("HttpExample")
logger.LogInformation("F# HTTP trigger function processed a request.")

let response = req.CreateResponse(HttpStatusCode.OK)
response.Headers.Add("Content-Type", "text/plain; charset=utf-8")

response.WriteString("Welcome to Azure Functions!")
```

_Program.fs:_

```fsharp
namespace fsharp_isolated

open System.Threading.Tasks;
open Microsoft.Extensions.Configuration;
open Microsoft.Extensions.Hosting;
open Microsoft.Azure.Functions.Worker.Configuration;

module Program =
[]
let main _ =
let hostBuilder = new HostBuilder()
hostBuilder.ConfigureFunctionsWorkerDefaults() |> ignore

let host = hostBuilder.Build()
host.Run()

0
```

The full project is here: https://github.com/recumbent/fsharp-isolated

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.