F# compilation issues when using JSON type provider #1044

Closed
gshackles opened this Issue Dec 11, 2016 · 2 comments

Projects

None yet

4 participants

@gshackles
gshackles commented Dec 11, 2016 edited

I'm running into compilation/availability issues when trying to use the JSON type provider in my F# functions. In some cases things seem to compile just fine, but in others the compiler just seems to disappear indefinitely.

In these cases, after it detects a change it will show a log message about reloading the function but then the compiler never actually reports back with a success or failure, even after waiting for awhile. Sometimes I will also get messages like these during this period of the function going AWOL:

Function ($RebuildSearchIndex) Error: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.

We are unable to reach your function app (Not Found). Please try again later.

After spending awhile playing around with new functions and distilling down my code, it definitely seems to be the JSON type provider code that is triggering the scenario.

Repro steps

Provide the steps required to reproduce the problem

  1. Create a new manually triggered F# function

  2. Add FSharp.Data

{
    "frameworks": {
        "net46": {
            "dependencies": {
                "FSharp.Data": "2.3.2"
            }
        }
    }
}
  1. Copy/paste this as the function definition:
open System
open FSharp.Data

type SearchResults = JsonProvider<""" {"value": [{ "ShowId": "abc" }]} """>
type DeleteRequest = JsonProvider<""" {"value": [{ "@search.action": "delete", "ShowId": "abc" }]} """>

let thisFunctionMakesThingsSad() = 
    SearchResults.Root([||]).Value
    |> Seq.map (fun result -> DeleteRequest.Value("delete", result.ShowId))
    |> Array.ofSeq
    |> DeleteRequest.Root
    |> ignore

let Run(input: string, log: TraceWriter) =
    sprintf "Processing: %s" input |> log.Info

Expected behavior

The function compiles successfully (or at least reports any errors it encounters, though this does work fine outside of Azure Functions).

Actual behavior

The compiler goes AWOL and the above errors start being reported, taking the function out of commission entirely.

Known workarounds

None I've found thus far

@lindydonna
Member
lindydonna commented Dec 12, 2016 edited

This issue will most likely be addressed by the fix for #985.

@fabiocav fabiocav was assigned by lindydonna Dec 12, 2016
@lindydonna lindydonna added this to the November December 2016 milestone Dec 12, 2016
@fabiocav fabiocav closed this in #1049 Dec 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment