Fable: Compile FSharp.Data.GraphQL Client got some strange errors

Created on 28 Sep 2017  ยท  10Comments  ยท  Source: fable-compiler/Fable

I'm trying using FSharp.Data.GraphQL(nuget version) in safe-stack, the ionide editor worked with graphql type provider, but when I build with webpack, at first it throws 1 error, then GraphQLTypeProvider cannot find, then there are no build errors, no console errors, but the async query code just not working.

Then I tried to debug with fable-spliter, but got this error:

z at ZsMBP in ~/Projects/Fable/FSharpBB (masterโ—)
$ npm run lib

> @ lib /Users/z/Projects/Fable/FSharpBB
> fable-splitter ./src/Client/Client.fsproj -o ./src/Client/lib

fable: Compilation started at 22:50:11
fable: Compiled src/Client/App.fs
fable: Compiled src/Client/GraphqlTest.fs
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/String.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Date.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Long.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Int32.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Symbol.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/TimeSpan.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Util.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/RegExp.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Async.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/AsyncBuilder.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Choice.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Seq.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Array.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/ListClass.js
fable: Compiled src/Client/pages/Login.fs
fable: Compiled src/Server/Shared/Domain.fs
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/List.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Map.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Comparer.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Serialize.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Reflection.js
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Set.js
fable: Compiled ../../../.nuget/packages/fable.powerpack/1.2.0/fable/src/Fetch.fs
fable: Compiled ../../../.nuget/packages/fable.powerpack/1.2.0/fable/src/Promise.fs
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/Result.js
fable: Compiled ../../../.nuget/packages/fable.elmish/0.9.2/fable/cmd.fs
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/CurriedLambda.js
fable: Compiled src/Client/Messages.fs
fable: Compiled ../../../.nuget/packages/fable.react/1.2.0/fable/Fable.Helpers.React.fs
fable: Compiled src/Client/pages/WishList.fs
fable: Compiled src/Client/Style.fs
fable: Compiled src/Client/pages/Menu.fs
fable: Compiled src/Client/Utils.fs
fable: Compiled ../../../.nuget/packages/fable.elmish.browser/0.9.0/fable/parser.fs
fable: Compiled ../../../.nuget/packages/fable.elmish.browser/0.9.0/fable/prelude.fs
fable: Compiled ../../../.nuget/packages/fable.elmish.browser/0.9.0/fable/navigation.fs
fable: Compiled ../../../.nuget/packages/fable.elmish/0.9.2/fable/program.fs
fable: Compiled ../../../.nuget/packages/fable.core/1.2.3/fable-core/MailboxProcessor.js
fable: Compiled ../../../.nuget/packages/fable.elmish.react/0.9.0/fable/common.fs
fable: Compiled src/Client/ReleaseNotes.fs
fable: Compiled ../../../.nuget/packages/fable.elmish.react/0.9.0/fable/react.fs
/Users/z/Projects/Fable/FSharpBB/src/Client/GraphqlTest.fs(11,16): (11,31) error FSHARP: The type 'GraphQLProvider' is not defined. Maybe you want one of the following:
   GraphQlProvider
   GraphQLReply
   GraphQLException
   GraphQLReply`1
/Users/z/Projects/Fable/FSharpBB/src/Client/GraphqlTest.fs(11,16): (11,31) error FSHARP: The type 'GraphQLProvider' is not defined. Maybe you want one of the following:
   GraphQlProvider
   GraphQLReply
   GraphQLException
   GraphQLReply`1
/Users/z/Projects/Fable/FSharpBB/src/Client/GraphqlTest.fs(17,29): (17,36) error FSHARP: The field, constructor or member 'Queries' is not defined.
/Users/z/Projects/Fable/FSharpBB/src/Client/GraphqlTest.fs(26,36): (26,45) error FSHARP: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
/Users/z/Projects/Fable/FSharpBB/src/Client/GraphqlTest.fs(27,49): (27,54) error FSHARP: The field, constructor or member 'Types' is not defined.
/Users/z/Projects/Fable/FSharpBB/src/Client/GraphqlTest.fs(28,17): (28,31) error FSHARP: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
/Users/z/Projects/Fable/FSharpBB/src/Client/GraphqlTest.fs(28,62): (28,67) error FSHARP: The field, constructor or member 'Types' is not defined.
/Users/z/Projects/Fable/FSharpBB/src/Client/GraphqlTest.fs(30,12): (30,24) error FSHARP: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
/Users/z/Projects/Fable/FSharpBB/src/Client/GraphqlTest.fs(31,38): (31,44) error FSHARP: Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved.
/Users/z/Projects/Fable/FSharpBB/src/Client/GraphqlTest.fs(48,29): (48,34) error FSHARP: The field, constructor or member 'Query' is not defined.
/Users/z/Projects/Fable/FSharpBB/src/Client/GraphqlTest.fs(60,29): (60,34) error FSHARP: The field, constructor or member 'Query' is not defined.
fable: Compilation failed at 22:50:42 (30.914 s)

npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "lib"
npm ERR! node v6.3.1
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! @ lib: `fable-splitter ./src/Client/Client.fsproj -o ./src/Client/lib`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ lib script 'fable-splitter ./src/Client/Client.fsproj -o ./src/Client/lib'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     fable-splitter ./src/Client/Client.fsproj -o ./src/Client/lib
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/z/Projects/Fable/FSharpBB/npm-debug.log

Here is the repo: https://github.com/FSharp-CN/FSharpBB

revisit

All 10 comments

Hehe, I've nightmares with GraphQL :wink: I wrote the Fable part for the GraphQL provider (defined within #if FABLE_COMPILER directives) but I did it with a previous version of Fable and haven't tried with the latest one. Unfortunately I'm not able to maintain the provider any more (I also don't think that GraphQL is a good fit for F#, but this is a personal opinion). I don't know what's the cause of the problem but looking at the error maybe it's just a spelling issue? Maybe related to this line?

BTW, in any case it seems Type Providers are working with Fable, this is good news.

@alfonsogarciacaro Thanks! I can't believe I didn't notice the message , I'll try it today. Actually I notice your great work in FSharp.Data.GraphQL, the main reason I choose.

BTW, I think GraphQL might not be needed in safe-stack, but at least it's the most popular cross-language server-client protocol with good tooling, the best choice to communicate with clients write in different language, in my case, is android(java) for now.

@alfonsogarciacaro I tried, looks like this isn't a typo. Still don't know what's the reason, and the build error are not show every time. The query async method can execute util before the query, but no request.

The FSharp.Data.GraphQL.Client project requires net45, and used some API that does not exist in dotnet core 2.0. Would this be the problem?

Could be, a workaround seems to be needed to run TPs on netcore but I don't know the details :/

Actually I did this trick already...

Still no luck, can fable build using mono? Or the best way to do is not using Type Provider for know, which might not be a big deal, and waiting for type provider support dotnet core.

Yes, you should be able to compile Fable for .NET Framework, you only need to change the target framework of the project files and define the NETFX directive. Unfortunately, I cannot maintain another target with different build process, publishing, distribution, documentation, maintenance, etc. so if you need it you'll have to create a custom build.

I was indeed thinking to wait until Type Providers are better supported in NETCore, I know they are very cool and it'd be great if you or someone in the community could check how to make them work with Fable, but at the moment there are other things in the roadmap that I need to focus on :/

I tried again, it seems it doesn't generate any type in fable, but also doesn't produce any other error..I'll keep watching, hoping it won't take too long for dotnet core to support type provider..

According to dsyme, currently FCS doesn't support TP when targeting netcoreapp 2.0, but it's already been fixed in Microsoft/visualfsharp(without much test), and still need some time to merge into FCS, but I also notice Fable is using a fork of FCS (Fable.FCS), so this also need to update from upstream before we could test TP in Fable..

Just for reminding me or someone else don't forget to check it out after all is done ;) .

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SCullman picture SCullman  ยท  49Comments

tomcl picture tomcl  ยท  26Comments

et1975 picture et1975  ยท  43Comments

ncave picture ncave  ยท  35Comments

alfonsogarciacaro picture alfonsogarciacaro  ยท  57Comments