installed the latest 1.6.0 with relay compiler fixes I was hoping to use and ran into a cryptic error that looks like it's a bug in the compiler script after logging "Writing js" in the CodegenRunner.js file and attempting to validate the validation rules in ASTConvert.js. The problem looks like missing functions in the validation rules, the error output I'm receiving is "rule is not a function". I've double checked my schema and src inputs and both look ok, I'm not sure where the rule's schema function is being set to undefined, hoping to get some help in tracing it further. I'm unable to generate any Query or Mutation files at this time using 1.6.0.
File: graphql-compiler/lib/ASTConvert.js
Function: function convertASTDefinitions(schema, definitions, validationRules, transform)
LIne: 120 (approx, shuffled some of my local code around)
Problem: When calling validate on GraphQLValidator, the validation rules fail since some of the functions are undefined. One of them I believe is the Schema Function as I tried to substitute it and the subsequent error resulted in "Missing Schema"
$ relay-compiler --src ./src --schema ./env/schema.graphql
HINT: pass --watch to keep watching for changes.
Writing js
ERROR:
rule is not a function
error Command failed with exit code 100.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[ [Function: FragmentsOnCompositeTypes],
[Function: KnownTypeNames],
[Function: LoneAnonymousOperation],
[Function: PossibleFragmentSpreads],
[Function: ScalarLeafs],
undefined,
undefined,
[Function: VariablesAreInputTypes],
[Function: VariablesInAllowedPosition],
[Function: DisallowIdAsAliasValidationRule],
[Function: KnownArgumentNames],
[Function: NoUnusedVariables],
[Function: ProvidedNonNullArguments],
[Function: UniqueArgumentNames],
[Function: UniqueFragmentNames],
[Function: UniqueInputFieldNames],
[Function: UniqueOperationNames],
[Function: UniqueVariableNames] ]
What version of graphql are you using? I've updated the Relay TodoMVC example to 1.6.0 and I'm not getting the error there.
Mind testing if that project also breaks for you? https://github.com/relayjs/relay-examples/tree/master/todo
That project's using [email protected] btw.
@kassens thanks for that check. I was using graphql 12.0, which I thought was supported. I did an update to 13.2 and got past this issue. The todo project tested through just fine.
Update graphql lib to 13.2 from 12.0 or lower.
Looks like we broke compatibility with graphql 0.12.x somewhere which is listed as acceptable in the peer dependency. Sending a PR to propose removing 0.12.x support.
I am getting this error as well after updating to 1.6, however I don't have Graphql installed as a node module. We have our backend written in Go. We are using the latest for that as well:
[[constraint]]
name = "github.com/graphql-go/graphql"
version = "0.7.5"
Should I revert my packages for Relay or am I doing something wrong?
yarn add graphql in your relay project should fix this
Hmm.. That changed the error to:
Expected undefined to be a GraphQL leaf type. error An unexpected error occurred: "Command failed.
Exit code: 100
Command: sh
Arguments: -c relay-compiler --src ./app --schema ./schema.graphql
Directory: xxx
Output:
".
Our code has been working pre 1.6 (we have been using 1.3 in production), so I'm not sure why this error would appear with no context. The docs didn't look to have any breaking changes relevant to us. Do you have any insight you can give @sibelius?
@Auchindoun I think you might be using graphql 12.x, could you check and upgrade to 0.13.x?
@kassens Yep, running react 16.3.2, graphql 0.13.2, react-relay 1.6.0, and relay-compiler 1.6.0
Confirming: graphql14.0 does not work. Locking on 0.13.2 -
TL;DR > run yarn add [email protected]
@okbel are you seeing the same error as above with graphql 14.0?
I got the same error with graphql 0.14.0 -- reverting to 0.13.2 seems to have resolved it.
yarn add graphqlin your relay project should fix this
This worked in my case
Most helpful comment
Confirming: graphql
14.0does not work. Locking on0.13.2-TL;DR > run
yarn add [email protected]