Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gave it a (unsuccessful) try #6

Open
idkjs opened this issue Nov 6, 2017 · 2 comments
Open

Gave it a (unsuccessful) try #6

idkjs opened this issue Nov 6, 2017 · 2 comments

Comments

@idkjs
Copy link

idkjs commented Nov 6, 2017

macOS Sierra

Node 9.

i ran graphql init and to get .graphqlconfig:

$ graphql init
? Local schema file path: schema.graphql
? Endpoint URL (Enter to skip): https://api.graph.cool/relay
/v1/cj9o4se940gsu0148s5a4helr
? Name of this endpoint, for e.g. default, dev, prod: server


? Subscription URL (Enter to skip):
? Do you want to add other endpoints? No
? What format do you want to save your config in? JSON

About to write to /Users/shingdev/code/GRAPHCOOL/react-graphql/quickstart-with-relay-modern/.graphqlconfig:

{
  "schemaPath": "schema.graphql",
  "extensions": {
    "endpoints": {
      "server": "https://api.graph.cool/relay/v1/cj9o4se940gsu0148s5a4helr"
    }
  }
}

? Is this ok? Yes```

then ran graphql get-schema, which saw no changes with the previously existing schema.graphql file which seemed correct.

$ graphql get-schema
Downloading introspection from https://api.graph.cool/relay/v1/cj9o4se940gsu0148s5a4helr
No changes


I then ran graphql load which failed with this json file [https://gist.github.com/idkjs/06d10b7a02edb8e6a2b10cb4608bdaa4] :

$ graphql load -m createCompany --json companies.json
Using endpoint server: undefined
Using mutation "createCompany": "".
Done parsing JSON-file /Users/shingdev/code/GRAPHCOOL/react-graphql/quickstart-with-relay-modern/companies.json rows: 90
Sending query:
mutation {

}...

Parameter "url" must be a string, not undefined

I changed the endpoint in graphconfig to this:


{
"schemaPath": "schema.graphql",
"extensions": {
"endpoints": {
"server": {"url":"https://api.graph.cool/relay/v1/cj9o4se940gsu0148s5a4helr"}
}
}
}


Which produced this error:

```sh
GraphQL Error (Code: 200): {"response":{"error":"Syntax error while parsing GraphQL query. Invalid input \"mutation { \\n\\n}\", expected OperationDefinition, FragmentDefinition or TypeSystemDefinition (line 1, column 1):\nmutation { \n^","status":200},"request":{"query":"mutation { \n\n}","variables":{}}}

This is my graphcool playground mutation def:

screen shot 2017-11-06 at 13 51 14

This is what the mutation looks like in DevTools if I do one manually

-mutation & variables

mutation CreateCompanyMutation(
  $input: CreateCompanyInput!
) {
  createCompany(input: $input) {
    company {
      id
      description
      logo
    }
  }
}
  • variables
{
    "input": {
        "description": "testatt",
        "logo": "https://d25e16a427ed3ce77d27-76b466cd72f6b3a6e7219a8a02851d8e.ssl.cf1.rackcdn.com/files/59382428ff3935425ca91516/size_5_1001pharmaciesjpg.jpg",
        "clientMutationId": ""
    }
}

Any ideas? Thank you.

@jexp
Copy link
Contributor

jexp commented Nov 7, 2017

Thanks a lot for the feedback, I think it's because of the input object.

Could you do me a favor and try with a simple mutation that just uses scalars.

I have to add support for input objects, which are more tricky to map to.

What does your JSON file look like?

@idkjs
Copy link
Author

idkjs commented Nov 9, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants