Azure / Azure/azure-functions-core-tools
Blob trigger function F# isolated template contains a compiler error
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 498
- Avg merge
- 5d 4h
- Merged PRs (30d)
- 15
Description
The default blob triggered function for F# isolated contains a compiler error.
Here are the Azure function core tools and runtime version:
```bash
% func
Azure Functions Core Tools
Core Tools Version: 4.0.5348 Commit hash: N/A (64-bit)
Function Runtime Version: 4.24.5.21262
```
After running `func new` and choosing a `BlobTrigger` function, here's the generated code for a function I named `ReadBlob`:
```fsharp
namespace Comrit.Functions
open System
open System.IO
open Microsoft.Azure.Functions.Worker
open Microsoft.Extensions.Logging
module ReadBlob =
[]
let run
(
[] myBlob: Stream,
name: string,
context: FunctionContext
) =
let logger
= context.GetLogger "ReadBlob"
use blobStreamReader
= new StreamReader(myBlob)
let blobContent
= blobStreamReader.ReadToEndAsync() |> Async.AwaitTask
let msg =
sprintf "F# Blob trigger function Processed blob\nName: %s \n Data: %s" name blobContent
logger.LogInformation msg
```
When attempting `dotnet build`, I get the following compiler error:
```
ReadBlob.fs(27,90): error FS0001: This expression was expected to have type 'string' but here has type 'Async'
```
This makes sense, since the ansychronous computation to read the blob stream was never performed. An extra operation, like `Async.RunSynchronously`, needs to be performed to actually perform the computation and read the string.
I've included screenshots of the compiler error:
Let me know if you need any additional information.
Contributor guide
Assessment
This issue has not been assessed yet.