Error with reason-apollo and reason-react


#1

I’ve just setup a skeleton project with reason-apollo and reason-react.

I created a trivial .re file and in VSCode I’m seeing this error:

Failure("Ast_mapper: OCaml version mismatch or malformed input")
File "/Users/kevan.stannard/dev/hello-graphql-reason/node_modules/.lsp/Hello-YourProjectName.ast", line 1:
Error: Error while running external preprocessor
Command line: /Users/kevan.stannard/dev/hello-graphql-reason/node_modules/graphql_ppx/ppx '/var/folders/fc/4yp7tfsj2j30rtd84_w3nh280000gp/T/camlppx62afbf' '/var/folders/fc/4yp7tfsj2j30rtd84_w3nh280000gp/T/camlppx41e7e7'

While investigating I found this page:

Checking versions:

$ bsc -version
BuckleScript 7.0.1 ( Using OCaml:4.06.1+BS )
$ ocaml -version
The OCaml toplevel, version 4.09.0

Any suggestions appreciated. Also, not sure which project to report this on, so posting here first.

Thanks


'reason-vscode' plugin errors on incompatible versions ocaml/preprocessor
#2

Hey it looks like the reason-apollo package is using a deprecated compiler extension: https://github.com/apollographql/reason-apollo/blob/8973fbb25bebcfedff66bddf08568dc4c51fc75b/package.json#L21

If you check the upgrade guide you’ll see it’s actually recommended to move from graphql_ppx to graphql_ppx_re: https://bucklescript.github.io/docs/en/upgrade-to-v7#dependencies

In your case for now you can actually just downgrade BuckleScript to the last known stable version which should work with reason-apollo, version 5.2.1.

But in the mid-to-long term you can (should) raise an issue with them to upgrade (or check if they have one already).


#3

@yawaramin great, thank you!