graphql_ppx icon indicating copy to clipboard operation
graphql_ppx copied to clipboard

Mutations not compiling: `Option.Option_unwrap_error`

Open jessep opened this issue 6 years ago • 3 comments

I'm getting some inscrutable errors. When I paste the following example from the README:

module SignUpQuery = [%graphql
  {|
mutation($name: String!, $email: String!, $password: String!) {
  signUp(email: $email, email: $email, password: $password) @bsVariant {
    user {
      name
    }

    errors {
      field
      message
    }
  }
}
|}
];

I get the following output:

>>>> Start compiling
Rebuilding since [ [ 'change', 'Query.re' ] ]
ninja: Entering directory `lib/bs'
[1/2] Building client/src/Query.mlast
FAILED: client/src/Query.mlast
/Users/jessep/Dropbox/Code/movement/node_modules/bs-platform/lib/bsc.exe -pp "/Users/jessep/Dropbox/Code/movement/node_modules/bs-platform/lib/refmt.exe --print binary" -ppx '/Users/jessep/Dropbox/Code/movement/node_modules/bs-platform/lib/reactjs_jsx_ppx_2.exe'  -ppx /Users/jessep/Dropbox/Code/movement/node_modules/graphql_ppx/ppx -w -30-40+6+7+27+32..39+44+45+101 -bs-suffix -nostdlib -I '/Users/jessep/Dropbox/Code/movement/node_modules/bs-platform/lib/ocaml' -no-alias-deps -color always -c -o client/src/Query.mlast -bs-syntax-only -bs-binary-ast -impl /Users/jessep/Dropbox/Code/movement/client/src/Query.re
Option.Option_unwrap_error
File "/Users/jessep/Dropbox/Code/movement/client/src/Query.re", line 1, characters 0-0:
Error: Error while running external preprocessor
Command line: /Users/jessep/Dropbox/Code/movement/node_modules/graphql_ppx/ppx '/var/folders/5x/w6vwvtzn1ts97f42_0kf74200000gn/T/camlppx803ef4' '/var/folders/5x/w6vwvtzn1ts97f42_0kf74200000gn/T/camlppx4a607c'

ninja: error: rebuilding 'build.ninja': subcommand failed
>>>> Finish compiling(exit: 1)

I have no idea what to do here. Here are versions of bs-platform and graphql_ppx From my package.json

 "bs-platform": "^3.1.5",
  "graphql_ppx": "^0.2.4"

jessep avatar Jul 06 '18 18:07 jessep

I should also mention that non-mutation queries seem to work as expected.

jessep avatar Jul 06 '18 18:07 jessep

What does your schema look like; does it contain a signUp mutation with those fields?

It's definitely a bug that the error message is an Option_unwrap_error, so I'm a bit curious as to how your schema looks to produce this bug.

mhallin avatar Jul 07 '18 09:07 mhallin

It was in fact related to the schema. I didn't have any mutations defined in the schema, and was confused because all sorts of other stuff that wasn't in the schema was still giving me proper errors.

jessep avatar Jul 08 '18 02:07 jessep