teamwalnut / graphql-ppx

GraphQL language primitives for ReScript/ReasonML written in ReasonML
https://graphql-ppx.com
MIT License
257 stars 53 forks source link

Error while running external preprocessor #259

Closed SamWoolerton closed 3 years ago

SamWoolerton commented 3 years ago

I'm getting a compilation error to do with the PPX when I try follow the getting started guide for rescript-urql. The query looks fine to me (copy-pasted the whole example module) so not sure why it won't compile. I first raised this issue in that repo but was directed here instead.

Can confirm that my graphql_schema.json and bsconfig.json files are valid JSON.

Here's the command line output (on Windows; same thing happens on WSL):

>>>> Start compiling 
rescript: [1/3] src/utility/GraphQL.ast
FAILED: src/utility/GraphQL.ast
Fatal error: exception Yojson.Json_error("Line 1, bytes 0-33:\nInvalid token '\255\254{\000\r\000\n\000 \000 \000\"\000_\000_\000s\000c\000h\000e\000m\000a\000\"\000:'")

  We've found a bug for you!
  C:\programming\mem\src\utility\GraphQL.res

  Error while running external preprocessor
Command line: C:\programming\mem\node_modules\@reasonml-community\graphql-ppx\ppx "C:\Users\samw\AppData\Local\Temp\ppxd9e1a1GraphQL.res" "C:\Users\samw\AppData\Local\Temp\ppxe67fe2GraphQL.res"

FAILED: cannot make progress due to previous errors.
>>>> Finish compiling(exit: 1)
SamWoolerton commented 3 years ago

Update: turns out get-graphql-schema generated the file as UTF-16, which looked fine in VS Code but was the source of the issues (see this issue). Not sure if UTF-16 is something you want to support, so I'll leave this issue open for now but happy to close it as I'm up and running again.