Apollo-server: "Expected Type String, found String" error: say what?

Created on 27 May 2018  路  4Comments  路  Source: apollographql/apollo-server

I have an Apollo Graphql server up and running. I can make queries using the graphiql just fine.
BUT: When I try to make the same queries using cross-fetch OR Postman, i get no end of troubles.

Postman shows the following error from the server:

{"errors":[{"message":"Expected type String, found String.","locations":[{"line":1,"column":35}]},{"message":"Expected type String, found String.","locations":[{"line":1,"column":52}]},{"message":"Expected type String, found String.","locations":[{"line":1,"column":69}]}]}

The request was this ( copied right from server console.log statement ):

{"query":"        {        login(RQToken: String, username:String, password:String) {            RQToken          }        }      ","variables":{"username":"aoeu","password":"aoeu"}}

What is sending me a little crazy is I get three errors that all say "Expected type String, found String".
WHAT? WHAT ? it wants a string, it got a string. It tells me this is an error.

What I have done so far:

  • Tested the same request successfully in graphiql.
  • Replicated the graphiql request in postmant
  • AND in cross-fetch in a react action.
  • Ruled out CORS issues with a basic route on the graphql server that works from cross-fetch and postman.
  • Console.logged the body in the server side to be sure all the requests are the same.
  • Tried also using the ApolloClient from ApolloBoost. This gives me a "fetch not found globally" error even though I pass in cross-fetch... that may end up in a post over on that site.

Thank you in advance.
Robert

Most helpful comment

What is sending me a little crazy is I get three errors that all say "Expected type String, found String".
WHAT? WHAT ? it wants a string, it got a string.

Thank goodness someone found this as humorously frustrating as I have.

All 4 comments

If that's the actual query, then it's not quite formatted correctly. You probably want something more like this -

query getLogin($username: String, $password: String){
    login(username: $username, password: $password) {            RQToken          }
}

And then still passing username and password variables as you've shown in your example

Eugene,

thanks so much for answering. I will give it a try and let you know.. Best, Robert

@eugene1g Thank you!

What is sending me a little crazy is I get three errors that all say "Expected type String, found String".
WHAT? WHAT ? it wants a string, it got a string.

Thank goodness someone found this as humorously frustrating as I have.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

attdona picture attdona  路  3Comments

espoal picture espoal  路  3Comments

danilobuerger picture danilobuerger  路  3Comments

deathg0d picture deathg0d  路  3Comments

veeramarni picture veeramarni  路  3Comments