Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F# compilation issues when using JSON type provider #1044

Closed
gshackles opened this issue Dec 11, 2016 · 2 comments · Fixed by #1049
Closed

F# compilation issues when using JSON type provider #1044

gshackles opened this issue Dec 11, 2016 · 2 comments · Fixed by #1049

Comments

@gshackles
Copy link

gshackles commented Dec 11, 2016

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

@JonCanning
Copy link

#985

@lindydonna
Copy link
Contributor

lindydonna commented Dec 12, 2016

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants